[Issue 15738] Problem with std.experimental.ndslice empty()
https://issues.dlang.org/show_bug.cgi?id=15738 Илья Ярошенко changed: What|Removed |Added CC||ilyayaroshe...@gmail.com --- Comment #1 from Илья Ярошенко --- 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. --
[Issue 15738] Problem with std.experimental.ndslice empty()
https://issues.dlang.org/show_bug.cgi?id=15738 Илья Ярошенко changed: What|Removed |Added Hardware|x86_64 |All OS|Windows |All Severity|normal |enhancement --
[Issue 15738] Problem with std.experimental.ndslice empty()
https://issues.dlang.org/show_bug.cgi?id=15738 --- Comment #2 from bearophile_h...@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. --
[Issue 15738] Problem with std.experimental.ndslice empty()
https://issues.dlang.org/show_bug.cgi?id=15738 --- Comment #3 from Илья Ярошенко --- (In reply to bearophile_hugs from comment #2) > (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. Slice is not a container, so there is no reason for such behavior. `empty` must be as fast as possible because a user may use slices with std.algorithm and std.range. --
[Issue 15738] Problem with std.experimental.ndslice empty()
https://issues.dlang.org/show_bug.cgi?id=15738 Илья Ярошенко changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --