[Issue 3123] New: std.algorithm.zip fails on 'lazy' ranges
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Jul  1 12:16:55 PDT 2009
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=3123
           Summary: std.algorithm.zip fails on 'lazy' ranges
           Product: D
           Version: 2.030
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: k-foley at onu.edu
By 'lazy' range, I mean what iota, map, take, etc. return.  I don't know the
correct term for these types of ranges.
----
auto a = [1, 2, 3, 4, 5][];
auto b = [2, 4, 6, 8, 10][];
// this compiles and works fine
foreach ( e; zip(a, b) ) writeln( "(", e.at!0, ", ", e.at!1, ")" );
// the following do not
foreach ( e; zip(a, iota(0, 6)) ) writeln( "(", e.at!0, ", ", e.at!1, ")" );
foreach ( e; zip(a, take(5, repeat(42))) ) writeln( "(", e.at!0, ", ", e.at!1,
")" );
foreach ( e; zip(a, map!(`a*a`)(a)) ) writeln( "(", e.at!0, ", ", e.at!1, ")"
);
----
Here is the compilation error:
C:\d\dmd.2.030\dmd\windows\bin\..\..\src\phobos\std\range.d(1734): Error:
cannot
 implicitly convert expression (&this.ranges._field_field_1.front) of type int
d
elegate() to int*
-- 
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