Function Vector.length

Returns the length of the vector, in terms of number of elements.

size_t length() const pure nothrow @nogc @property scope @safe;

This is the number of actual elements that conform the contents of the Vector, which is not necessarily equal to its storage capacity.

Examples

Vector!(int, 10) vec = null;
assert(vec.length == 0);

vec.append(42);
assert(vec.length == 1);

vec.append(123);
assert(vec.length == 2);

vec.clear();
assert(vec.length == 0);