Contents

reserveCapacity(_:)

Ensure that the array has capacity to store the specified number of elements, by growing its storage buffer if necessary.

Declaration

mutating func reserveCapacity(_ n: Int)

Discussion

If capacity < n, then this operation reallocates the unique array’s storage to grow it; on return, the array’s capacity becomes n. Otherwise the array is left as is.