Function Vector.downsize

Downsizes the vector to a length of n elements.

void downsize (
  const size_t n
) nothrow scope;

If n is smaller than the current vector length, the current value is shortened to its first n character, removing the characters beyond the nth.

If n is greater than the current vector length, then nothing happend.

Examples

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

vec.downsize(5);
assert(vec == [1, 2, 3]);

vec.downsize(2);
assert(vec == [1, 2]);