DoxigAlpha

insertSlice

Insert slice items at index i by moving list[i .. list.len] to make room. This operation is O(N). Invalidates pre-existing pointers to elements at and after index. Invalidates all pre-existing element pointers if capacity must be increased to accommodate the new elements. Asserts that the index is in bounds or equal to the length.

Function parameters

Parameters

#
self:*Self
index:usize
items:[]const T

Deprecated.

Functions

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

Source

Implementation

#
pub fn insertSlice(
    self: *Self,
    gpa: Allocator,
    index: usize,
    items: []const T,
) Allocator.Error!void {
    const dst = try self.addManyAt(
        gpa,
        index,
        items.len,
    );
    @memcpy(dst, items);
}