pub fn ensureTotalCapacity(self: *Self, gpa: Allocator, new_capacity: usize) Allocator.Error!void 1344
1345
1346
1347 pub fn ensureTotalCapacity(self: *Self, gpa: Allocator, new_capacity: usize) Allocator.Error!void {
if (self.capacity >= new_capacity) return;
return self.ensureTotalCapacityPrecise(gpa, growCapacity(new_capacity));
}
Modify the array so that it can hold at least
new_capacityitems. Implements super-linear growth to achieve amortized O(1) append operations. Invalidates element pointers if additional memory is needed.