Array.reserve

Reserves space for size elements.

If size is less than or equal to the $(D_PSYMBOL capacity), the function call does not cause a reallocation and the array capacity is not affected.

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

Parameters

size size_t

Desired size.

Examples

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

v.reserve(3);
assert(v.capacity == 3);
assert(v.length == 0);

Meta