DoxigAlpha

insert

Inserts an item into an ordered list. Shifts all elements after and including the specified index back by one and sets the given index to the specified element. May reallocate and invalidate iterators.

Function parameters

Parameters

#
self:*Self
index:usize
elem:T

A MultiArrayList stores a list of a struct or tagged union type.

Functions

#
MultiArrayList
A MultiArrayList stores a list of a struct or tagged union type.

Source

Implementation

#
pub fn insert(self: *Self, gpa: Allocator, index: usize, elem: T) !void {
    try self.ensureUnusedCapacity(gpa, 1);
    self.insertAssumeCapacity(index, elem);
}