poll for properties
bearophile
bearophileHUGS at lycos.com
Tue Jul 28 16:56:07 PDT 2009
Bill Baxter:
> The rationale for .empty is that .length could be an O(n) operation
> for some containers, but .empty should always be O(1). So, the
> negation of .length is not a general replacement for .empty.
I didn't know isEmpty() or opBool() must be O(1).
But I remember Andrei (and maybe other people too) strongly refuse my len() function that sometimes returns length (in O(1)) and sometimes iterates all items of a lazy iterable and returns their number in O(n) or more. So you may be wrong.
Bye,
bearophile
More information about the Digitalmars-d
mailing list