pub fn insertBounded(self: *Self, i: usize, item: T) error self: *Selfi: usizeitem: T838
839
840
841 pub fn insertBounded(self: *Self, i: usize, item: T) error{OutOfMemory}!void {
if (self.capacity - self.items.len == 0) return error.OutOfMemory;
return insertAssumeCapacity(self, i, item);
}
Insert
itemat indexindex. Moveslist[index .. list.len]to higher indices to make room. Ifindexis equal to the length of the list this operation is equivalent to appendAssumeCapacity. This operation is O(N). Invalidates pre-existing pointers to elements at and afterindex. Asserts that the index is in bounds or equal to the length. If the list lacks unused capacity for the additional item, returnserror.OutOfMemory.