DoxigAlpha

removeIndex

Remove and return element at index. Indices are in the same order as iterator, which is not necessarily priority order.

Function parameters

Parameters

#
self:*Self
index:usize

Priority Dequeue for storing generic data.

Functions

#
PriorityDequeue
Priority Dequeue for storing generic data.

Source

Implementation

#
pub fn removeIndex(self: *Self, index: usize) T {
    assert(self.len > index);
    const item = self.items[index];
    const last = self.items[self.len - 1];

    self.items[index] = last;
    self.len -= 1;
    siftDown(self, index);

    return item;
}