Array.capacity

Get the available capacity of the array; this is equal to length of the array plus the available pre-allocated, free, space.

struct Array(T)
@nogc nothrow pure @safe const
size_t
capacity
()

Return Value

Type: size_t

a positive integer denoting the capacity.

Complexity: O(1).

Examples

auto a = Array!int(1, 2, 3);
a.reserve(10);
assert(a.capacity == 10);

Meta