Make a hash out of two ranges

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Feb 27 19:59:05 PST 2013


On 2/28/13, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> import std.algorithm;
> import std.range;
>
> void main()
> {
>     auto r = map!((a, b) => [a : b])(["foo"], ["bar"]);  // error
>     assert(r.front == ["foo" : "bar"]);
> }
>
> This doesn't compile, what am I missing?
>

A more clearer example:

void main()
{
    auto r = map!((a, b) => [a : b])([1, 3], [2, 4]);
    assert(r[0] == [1 : 2]);
    assert(r[1] == [3 : 4]);
}


More information about the Digitalmars-d-learn mailing list