DoxigAlpha

addManyAsSlice

Resize the array, adding n new elements, which have undefined values. The return value is a slice pointing to the newly allocated elements. The returned pointer becomes invalid when the list is resized. Resizes list if self.capacity is not large enough.

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 addManyAsSlice(self: *Self, gpa: Allocator, n: usize) Allocator.Error![]T {
    const prev_len = self.items.len;
    try self.resize(gpa, try addOrOom(self.items.len, n));
    return self.items[prev_len..][0..n];
}