dcoder:

Also, is there any surprises / difference between the two:

if( !arr.length)

and

if( arr.empty)

do they produce the same thing all the time?

thanks.

No surprises here, thankfully. Its implementation:
https://raw.github.com/D-Programming-Language/phobos/master/std/array.d

@property bool empty(T)(in T[] a) @safe pure nothrow
{
    return !a.length;
}


In that file I'd like one more function like this:

@property bool empty(K, V)(in V[K] a) @safe pure nothrow
{
    return !a.length;
}

Bye,
bearophile

Reply via email to