poll for properties
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jul 28 16:49:50 PDT 2009
Bill Baxter wrote:
> On Tue, Jul 28, 2009 at 4:16 PM, bearophile<bearophileHUGS at lycos.com> wrote:
>
>> Another solution for D code (that I have used in my Set data structure. But it contains a negation):
>> if (!b.length) {...}
>
> 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.
Exactly.
Andrei
More information about the Digitalmars-d
mailing list