pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_capacity: usize) !void 349
350
351
352
353
354
355
356
357 pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_capacity: usize) !void {
var better_capacity = self.capacity();
if (better_capacity >= new_capacity) return;
while (true) {
better_capacity += better_capacity / 2 + 8;
if (better_capacity >= new_capacity) break;
}
self.items = try allocator.realloc(self.items, better_capacity);
}
Ensure that the dequeue can fit at least
new_capacityitems.