[Issue 8803] New: map.filter.array run map delegate an incorrect number of time.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 11 14:12:46 PDT 2012


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

           Summary: map.filter.array run map delegate an incorrect number
                    of time.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: deadalnix at gmail.com


--- Comment #0 from deadalnix <deadalnix at gmail.com> 2012-10-11 14:12:44 PDT ---
See sample code :

import std.algorithm;
import std.range;

void main() {
    uint i;

    uint[] iarray;
    iarray.length = 10;

    iarray.map!(a => i++).filter!(a => a > 0).array();

    import std.stdio;
    writeln(i);
}

This program output 19. In other terms, map delegate is run twice on every
element on which filter's delegate returns true.

-- 
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