DoxigAlpha

addOne

Increase length by 1, returning pointer to the new item. The returned pointer becomes invalid when the list resized.

Function parameters

Parameters

#
self:*Self

Deprecated.

Functions

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

Source

Implementation

#
pub fn addOne(self: *Self) Allocator.Error!*T {
    // This can never overflow because `self.items` can never occupy the whole address space
    const newlen = self.items.len + 1;
    try self.ensureTotalCapacity(newlen);
    return self.addOneAssumeCapacity();
}