Array.shrink

Requests the array to reduce its capacity to fit the size.

The request is non-binding. The array won't become smaller than the length.

struct Array(T)
@trusted
void
shrink
(
size_t size
)

Parameters

size size_t

Desired size.

Examples

Array!int v;
assert(v.capacity == 0);
assert(v.length == 0);

v.reserve(5);
v.insertBack(1);
v.insertBack(3);
assert(v.capacity == 5);
assert(v.length == 2);

Meta