Function Vector.clear

Erases the contents of the Vector, which becomes an empty vector (with a length of 0 elements).

void clear() nothrow scope;

Doesn't change capacity of vector.

Examples

Vector!(int, 6) vec = Vector!(int, 6).build(1, 2, 3);

vec.reserve(vec.capacity * 2);
assert(vec.length == 3);

const size_t cap = vec.capacity;
vec.clear();
assert(vec.capacity == cap);