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

A MultiArrayList stores a list of a struct or tagged union type.

Functions

#
MultiArrayList
A MultiArrayList stores a list of a struct or tagged union type.

Source

Implementation

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