Why is std.algorithm so complicated to use?

Jacob Carlborg doob at me.com
Mon Jul 9 13:09:54 PDT 2012


Almost every time I'm trying to use std.algorithm I run into some kind 
of error, for what seems to be fairly trivial and what one would expect 
to work. It feels like I'm constantly fighting with std.algorithm. For 
example:

import std.algorithm;
import std.range;

struct Foo {}

auto f = Foo();
auto foos = [f];
auto foo = foos.map!(x => "foo");
auto bar = foo.chain("bar");

This simple example result in the follow error:

http://pastebin.com/E4LV2UBE

Another example:

auto str = ["foo", "bar"].map!(x => x);
auto f = str.sort();

Results in:

http://pastebin.com/BeePWQk9

I'm using DMD 2.059.

-- 
/Jacob Carlborg



More information about the Digitalmars-d mailing list