What about putting array.empty in object.d?
Xinok
xinok at live.com
Wed Mar 21 08:50:46 PDT 2012
On Wednesday, 21 March 2012 at 04:54:54 UTC, Daniel Murphy wrote:
> FWIW, I would rather see `if (array)` translated to `if
> (array.length)` and
> this become the recomended way to check if an array is empty.
> Wouldn't that
> remove the dependency on std.array for most of the cases?
Nope. .length is a requirement for finite random-access ranges,
but not for forward or bidirectional ranges. .empty is the only
primitive required by all input ranges.
So if you pass an array to a function expecting a forward range,
it may not work if the primitive .empty doesn't exist.
More information about the Digitalmars-d
mailing list