pub fn ensureTotalCapacity(self: *Self, gpa: Allocator, new_capacity: usize) Allocator.Error!void 517
518
519
520 pub fn ensureTotalCapacity(self: *Self, gpa: Allocator, new_capacity: usize) Allocator.Error!void {
if (self.capacity >= new_capacity) return;
return self.setCapacity(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.