empty

Free-function empty, which does the expected thing whenever arg.length works.

pragma(inline)
bool
empty
(
T
)
(
ref const(T) arg
)
if (
is(typeof(arg.length) : size_t) &&
!__traits(hasMember, T, "empty")
)

Examples

struct S { size_t length; }

S a = { length: 0 };
assert(a.empty);

S b  = { length: 1 };
assert(!b.empty);