Comment #0 by bearophile_hugs — 2011-07-30T06:57:28Z
I suggest to extend std.array.empty to work with associative arrays too:
import std.array;
void main() {
int[] a;
assert(a.empty); // OK
int[int] aa;
assert(aa.empty); // Error
}
DMD 2.054:
test.d(6): Error: template std.array.empty(T) does not match any function template declaration
test.d(6): Error: template std.array.empty(T) cannot deduce template function from argument types !()(int[int])
Comment #1 by jack — 2016-06-27T19:57:06Z
What's the rationale? Why not just aa.length == 0?
Comment #2 by razvan.nitu1305 — 2017-09-07T12:42:41Z
I agree with @JackStouffer here, I don't see the point when you have aa.length. Should we close this?
Comment #3 by andrei — 2017-09-07T15:04:47Z
Let's support empty for AAs for uniformity. Thanks.
Comment #4 by petar.p.kirov — 2017-10-11T10:45:27Z