[Issue 16034] New: map should be possible with a reference only

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 17 05:31:17 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16034

          Issue ID: 16034
           Summary: map should be possible with a reference only
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: greensunny12 at gmail.com

the following doesn't work:

void main()
{
    struct One
    {
        int entry = 1;
        @disable this(this);
    }
    One[] ones = [One(), One()];

    import std.algorithm.iteration: map;
    import std.algorithm.comparison: equal;
    assert(ones.map!`a.entry + 1`.equal([2, 2]));
}

foo.d(12): Error: template std.algorithm.iteration.map!"a.entry + 1".map cannot
deduce function from argument types !()(One[]), candidates are:
/usr/include/dlang/dmd/std/algorithm/iteration.d(450):       
std.algorithm.iteration.map!"a.entry + 1".map(Range)(Range r) if
(isInputRange!(Unqual!Range))

(It doesn't matter whether string or real lambda are used)

--


More information about the Digitalmars-d-bugs mailing list