The OpenD Programming Language

hasLength

enum bool hasLength(R);

Return Value

true if R has a length member that returns an integral type implicitly convertible to size_t.

R does not have to be a range.

Examples

static assert(hasLength!(char[]));
static assert(hasLength!(int[]));
static assert(hasLength!(inout(int)[]));

struct B { size_t length() const { return 0; } }
struct C { @property size_t length() const { return 0; } }
static assert(hasLength!(B));
static assert(hasLength!(C));

Meta