Array.forceLength

Set the length of the array to len. len must be less than or equal to the capacity of the array.

struct Array(T)
@nogc nothrow pure @trusted
void
forceLength
(
size_t len
)

Parameters

len size_t

a positive integer

Complexity: O(1).

Examples

auto a = Array!int(1, 2, 3);
a.forceLength(2);
assert(a.length == 2);

Meta