[Issue 15738] Problem with std.experimental.ndslice empty()

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 5 10:03:28 PST 2016


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

--- Comment #2 from bearophile_hugs at eml.cc ---
(In reply to Илья Ярошенко from comment #1)
> This is feature, empty is empty!0, so it checks only first dimension. In
> addition, this  is very important for optimization reasons. emptyAny method
> may be added for desirable behavior.

I think it's a trap. empty === enoty!0 is not explicit. So it should be
designed the other way, in an explicit way. If you want to add a empty()
method, it should work on the whole tensor. If you want to see if one
coordinate is empty, you can add a more specialized method, like emptySide, or
something similar.

--


More information about the Digitalmars-d-bugs mailing list