ensureTotalCapacityPrecise
Function parameters
Parameters
- self:*Self
- new_capacity:usize
Priority queue for storing generic data.
Functions
- PriorityQueue
- Priority queue for storing generic data.
Source
Implementation
pub fn ensureTotalCapacityPrecise(self: *Self, new_capacity: usize) !void {
if (self.capacity() >= new_capacity) return;
const old_memory = self.allocatedSlice();
const new_memory = try self.allocator.realloc(old_memory, new_capacity);
self.items.ptr = new_memory.ptr;
self.cap = new_memory.len;
}