[Issue 16363] New: Cannot construct a random access range using frontTransversal
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sun Aug  7 18:35:52 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=16363
          Issue ID: 16363
           Summary: Cannot construct a random access range using
                    frontTransversal
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: kirsybuu at gmail.com
The current implementation of FrontTransversal and Transversal both do not
attempt to implement length or opDollar when the underlying range supports it,
thus even when using assumeNotJagged the output range will not be a random
access range.
import std.range;
void main() {
    int[][] darr = [[0, 1, 2], [4, 5, 6]];
    auto fT = frontTransversal!(TransverseOptions.assumeNotJagged)(darr);
    auto l = fT.length;
    auto s = fT[0 .. $];
    static assert(isRandomAccessRange!(typeof(fT)));
}
alex.d(5): Error: no property 'length' for type 'FrontTransversal!(int[][],
cast(TransverseOptions)2)'
alex.d(6): Error: undefined identifier '__dollar'
alex.d(7): Error: static assert 
(isRandomAccessRange!(FrontTransversal!(int[][], cast(TransverseOptions)2))) is
false
--
    
    
More information about the Digitalmars-d-bugs
mailing list