www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16442] New: FrontTransversal fails with empty ranges

https://issues.dlang.org/show_bug.cgi?id=16442

          Issue ID: 16442
           Summary: FrontTransversal fails with empty ranges
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: gruen_tobias web.de

If the input ROR of FrontTransversal consists of empty ranges
and the option assumeNotJagged || enforceNotJagged is set, the return value of
empty is wrong.

=== 
int[][] arr = [[], []];

auto ft = frontTransversal!(TransverseOptions.assumeNotJagged)(arr);

foreach(elem; ft) // fails here.. 
{

}

===
Will Throw a
core.exception.AssertError:"Attempting to fetch the front of an empty array of
int"

--
Aug 28 2016