Define .empty property for hashes?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Fri Mar 2 13:08:39 PST 2012
Is there a reason why there's no .empty property for hashes? std.array
defines it for arrays, and range types must have it defined. But
hashes are left out even though they define .length. This could be put
in std.array:
@property bool empty(T)(in T a)
if (isAssociativeArray!T)
{
return !a.length;
}
I can't mark it as neither pure, nothrow, nor safe. I guess that's an
implementation detail at this point.
More information about the Digitalmars-d-learn
mailing list