www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16034] New: map should be possible with a reference only


          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 puremagic.com
          Reporter: greensunny12 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:
std.algorithm.iteration.map!"a.entry + 1".map(Range)(Range r) if

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

May 17 2016