insertBounded
Insert item at index i, moving list[i .. list.len] to higher indices to make room.
If i is equal to the length of the list this operation is equivalent to append.
This operation is O(N).
If the list lacks unused capacity for the additional item, returns
error.OutOfMemory.
Asserts that the index is in bounds or equal to the length.
Function parameters
Parameters
- self:*Self
- i:usize
- item:T
Deprecated.
Functions
- Managed
- Deprecated.
- AlignedManaged
- Deprecated.
- Aligned
- A contiguous, growable list of arbitrarily aligned items in memory.
Source
Implementation
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);
}