addManyAtAssumeCapacity
Add count new elements at position index, which have
undefined values. Returns a slice pointing to the newly allocated
elements, which becomes invalid after various ArrayList
operations.
Asserts that there is enough capacity for the new elements.
Invalidates pre-existing pointers to elements at and after index, but
does not invalidate any before that.
Asserts that the index is in bounds or equal to the length.
Function parameters
Parameters
- self:*Self
- index:usize
- count:usize
Deprecated.
Functions
- Managed
- Deprecated.
- AlignedManaged
- Deprecated.
- Aligned
- A contiguous, growable list of arbitrarily aligned items in memory.
Source
Implementation
pub fn addManyAtAssumeCapacity(self: *Self, index: usize, count: usize) []T {
const new_len = self.items.len + count;
assert(self.capacity >= new_len);
const to_move = self.items[index..];
self.items.len = new_len;
@memmove(self.items[index + count ..][0..to_move.len], to_move);
const result = self.items[index..][0..count];
@memset(result, undefined);
return result;
}