DoxigAlpha

addManyAsSliceBounded

Resizes the array, adding n new elements, which have undefined values, returning a slice pointing to the newly allocated elements.

Never invalidates element pointers. The returned pointer becomes invalid when the list is resized.

If the list lacks unused capacity for the additional items, returns error.OutOfMemory.

Function parameters

Parameters

#
self:*Self
n:usize

Deprecated.

Functions

#
Managed
Deprecated.
AlignedManaged
Deprecated.
Aligned
A contiguous, growable list of arbitrarily aligned items in memory.

Source

Implementation

#
pub fn addManyAsSliceBounded(self: *Self, n: usize) error{OutOfMemory}![]T {
    if (self.capacity - self.items.len < n) return error.OutOfMemory;
    return addManyAsSliceAssumeCapacity(self, n);
}