Function Array.reserve
Reserves space for size elements.
void reserve
(
size_t size
) @trusted;
If size is less than or equal to the capacity, the function call does not cause a reallocation and the array capacity is not affected.
Parameters
Name | Description |
---|---|
size | Desired size. |
Example
Array!int v;
assert(v .capacity == 0);
assert(v .length == 0);
v .reserve(3);
assert(v .capacity == 3);
assert(v .length == 0);