DoxigAlpha

ensureTotalCapacity

Modify the array so that it can hold at least new_capacity items. Implements super-linear growth to achieve amortized O(1) append operations. Invalidates element pointers if additional memory is needed.

Function parameters

Parameters

#
self:*Self
new_capacity:usize

Deprecated.

Functions

#
Managed
Deprecated.
AlignedManaged
Deprecated.
Aligned
A contiguous, growable list of arbitrarily aligned items in memory.

Source

Implementation

#
pub fn ensureTotalCapacity(self: *Self, gpa: Allocator, new_capacity: usize) Allocator.Error!void {
    if (self.capacity >= new_capacity) return;
    return self.ensureTotalCapacityPrecise(gpa, growCapacity(self.capacity, new_capacity));
}