DoxigAlpha

appendNTimes

Append a value to the list n times. Allocates more memory as necessary. Invalidates element pointers if additional memory is needed. The function is inline so that a comptime-known value parameter will have a more optimal memset codegen in case it has a repeated byte pattern.

Function parameters

Parameters

#
self:*Self
value:T
n:usize

Deprecated.

Functions

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

Source

Implementation

#
pub inline fn appendNTimes(self: *Self, gpa: Allocator, value: T, n: usize) Allocator.Error!void {
    const old_len = self.items.len;
    try self.resize(gpa, try addOrOom(old_len, n));
    @memset(self.items[old_len..self.items.len], value);
}