www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15738] New: Problem with std.experimental.ndslice empty()

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

          Issue ID: 15738
           Summary: Problem with std.experimental.ndslice empty()
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

This code asserts, but it's correct:


void main() {
    import std.experimental.ndslice: sliced;
    auto v = [1];
    auto s1 = v[].sliced(1, 1);
    auto s2 = s1[0 .. $, 0 .. 0];
    assert(s2.empty);
}


If one (or more) coordinate has length zero, empty() must be true.

--
Mar 01 2016