[Issue 10130] New: map of iota with const step

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 21 15:23:00 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10130

           Summary: map of iota with const step
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-05-21 15:22:59 PDT ---
In this case map!() can't be applied on a iota():


import std.algorithm: map;
import std.range: iota;
void main() {
    const step = 2;
    iota(0, 10, step).map!(i => i);
}



DMD 2.063beta5 gives:

...\dmd2\src\phobos\std\algorithm.d(482): Error: cannot modify struct
result._input Result with immutable members
...\dmd2\src\phobos\std\algorithm.d(390): Error: template instance
test.main.MapResult!(__lambda2, Result) error instantiating
test.d(5):        instantiated from here: map!(Result)
test.d(5): Error: template instance test.main.map!(__lambda2).map!(Result)
error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list