pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type
A contiguous, growable list of arbitrarily aligned items in memory.
- Kind
- type function
- Module
std.array_list
pub fn addManyAsArray(self: *Self, gpa: Allocator, comptime n: usize) Allocator.Error!*[n]T
Resize the array, adding `n` new elements, which have `undefined` values.
- Kind
- function
- Module
std.array_list
pub fn addManyAsArrayAssumeCapacity(self: *Self, comptime n: usize) *[n]T
Resize the array, adding `n` new elements, which have `undefined` values.
- Kind
- function
- Module
std.array_list
pub fn addManyAsArrayBounded(self: *Self, comptime n: usize) error
Resize the array, adding `n` new elements, which have `undefined` values.
- Kind
- function
- Module
std.array_list
pub fn addManyAsSlice(self: *Self, gpa: Allocator, n: usize) Allocator.Error![]T
Resize the array, adding `n` new elements, which have `undefined` values.
- Kind
- function
- Module
std.array_list
pub fn addManyAsSliceAssumeCapacity(self: *Self, n: usize) []T
Resizes the array, adding `n` new elements, which have `undefined` values, returning a slice pointing to the newly allocated elements.
- Kind
- function
- Module
std.array_list
pub fn addManyAsSliceBounded(self: *Self, n: usize) error
Resizes the array, adding `n` new elements, which have `undefined` values, returning a slice pointing to the newly allocated elements.
- Kind
- function
- Module
std.array_list
pub fn addManyAt(self: *Self, gpa: Allocator, index: usize, count: usize) Allocator.Error![]T
Add `count` new elements at position `index`, which have `undefined` values.
- Kind
- function
- Module
std.array_list
pub fn addManyAtAssumeCapacity(self: *Self, index: usize, count: usize) []T
Add `count` new elements at position `index`, which have `undefined` values.
- Kind
- function
- Module
std.array_list
pub fn addManyAtBounded(self: *Self, index: usize, count: usize) error
Add `count` new elements at position `index`, which have `undefined` values, returning a slice pointing to the newly allocated elements, which becomes invalid after various `ArrayList` operations.
- Kind
- function
- Module
std.array_list
pub fn addOne(self: *Self, gpa: Allocator) Allocator.Error!*T
Increase length by 1, returning pointer to the new item.
- Kind
- function
- Module
std.array_list
pub fn addOneAssumeCapacity(self: *Self) *T
Increase length by 1, returning pointer to the new item.
- Kind
- function
- Module
std.array_list
pub fn addOneBounded(self: *Self) error
Increase length by 1, returning pointer to the new item.
- Kind
- function
- Module
std.array_list
pub fn allocatedSlice(self: Self) Slice
Returns a slice of all the items plus the extra capacity, whose memory contents are `undefined`.
- Kind
- function
- Module
std.array_list
pub fn append(self: *Self, gpa: Allocator, item: T) Allocator.Error!void
Extend the list by 1 element.
- Kind
- function
- Module
std.array_list
pub fn appendAssumeCapacity(self: *Self, item: T) void
Extend the list by 1 element.
- Kind
- function
- Module
std.array_list
pub fn appendBounded(self: *Self, item: T) error
Extend the list by 1 element.
- Kind
- function
- Module
std.array_list
pub fn appendNTimes(self: *Self, gpa: Allocator, value: T, n: usize) Allocator.Error!void
Append a value to the list `n` times.
- Kind
- function
- Module
std.array_list
pub fn appendNTimesAssumeCapacity(self: *Self, value: T, n: usize) void
Append a value to the list `n` times.
- Kind
- function
- Module
std.array_list
pub fn appendNTimesBounded(self: *Self, value: T, n: usize) error
Append a value to the list `n` times.
- Kind
- function
- Module
std.array_list
pub fn appendSlice(self: *Self, gpa: Allocator, items: []const T) Allocator.Error!void
Append the slice of items to the list.
- Kind
- function
- Module
std.array_list
pub fn appendSliceAssumeCapacity(self: *Self, items: []const T) void
Append the slice of items to the list.
- Kind
- function
- Module
std.array_list
pub fn appendSliceBounded(self: *Self, items: []const T) error
Append the slice of items to the list.
- Kind
- function
- Module
std.array_list
pub fn appendUnalignedSlice(self: *Self, gpa: Allocator, items: []align(1) const T) Allocator.Error!void
Append the slice of items to the list.
- Kind
- function
- Module
std.array_list
pub fn appendUnalignedSliceAssumeCapacity(self: *Self, items: []align(1) const T) void
Append an unaligned slice of items to the list.
- Kind
- function
- Module
std.array_list
pub fn appendUnalignedSliceBounded(self: *Self, items: []align(1) const T) error
Append an unaligned slice of items to the list.
- Kind
- function
- Module
std.array_list
pub fn clearAndFree(self: *Self, gpa: Allocator) void
Invalidates all element pointers.
- Kind
- function
- Module
std.array_list
pub fn clearRetainingCapacity(self: *Self) void
Reduce length to 0.
- Kind
- function
- Module
std.array_list
pub fn clone(self: Self, gpa: Allocator) Allocator.Error!Self
Creates a copy of this ArrayList.
- Kind
- function
- Module
std.array_list
pub fn deinit(self: *Self, gpa: Allocator) void
Release all allocated memory.
- Kind
- function
- Module
std.array_list
An ArrayList containing no elements.
- Kind
- constant
- Module
std.array_list
pub fn ensureTotalCapacity(self: *Self, gpa: Allocator, new_capacity: usize) Allocator.Error!void
Modify the array so that it can hold at least `new_capacity` items.
- Kind
- function
- Module
std.array_list
pub fn ensureTotalCapacityPrecise(self: *Self, gpa: Allocator, new_capacity: usize) Allocator.Error!void
If the current capacity is less than `new_capacity`, this function will modify the array so that it can hold exactly `new_capacity` items.
- Kind
- function
- Module
std.array_list
pub fn ensureUnusedCapacity(self: *Self, gpa: Allocator, additional_count: usize) Allocator.Error!void
Modify the array so that it can hold at least `additional_count` **more** items.
- Kind
- function
- Module
std.array_list
pub fn expandToCapacity(self: *Self) void
Increases the array's length to match the full capacity that is already allocated.
- Kind
- function
- Module
std.array_list
pub fn fromOwnedSlice(slice: Slice) Self
ArrayList takes ownership of the passed in slice.
- Kind
- function
- Module
std.array_list
pub fn fromOwnedSliceSentinel(comptime sentinel: T, slice: [:sentinel]T) Self
ArrayList takes ownership of the passed in slice.
- Kind
- function
- Module
std.array_list
pub fn growCapacity(minimum: usize) usize
Called when memory growth is necessary.
- Kind
- function
- Module
std.array_list
pub fn initBuffer(buffer: Slice) Self
Initialize with externally-managed memory.
- Kind
- function
- Module
std.array_list
pub fn initCapacity(gpa: Allocator, num: usize) Allocator.Error!Self
Initialize with capacity to hold exactly `num` elements.
- Kind
- function
- Module
std.array_list
pub fn insert(self: *Self, gpa: Allocator, index: usize, item: T) Allocator.Error!void
Insert `item` at index `index`.
- Kind
- function
- Module
std.array_list
pub fn insertAssumeCapacity(self: *Self, index: usize, item: T) void
Insert `item` at index `index`.
- Kind
- function
- Module
std.array_list
pub fn insertBounded(self: *Self, i: usize, item: T) error
Insert `item` at index `index`.
- Kind
- function
- Module
std.array_list
pub fn insertSlice(self: *Self, gpa: Allocator, index: usize, items: []const T) Allocator.Error!void
Insert slice `items` at index `index` by moving `list[index .. list.len]` to make room.
- Kind
- function
- Module
std.array_list
pub fn insertSliceAssumeCapacity(self: *Self, index: usize, items: []const T) void
Insert slice `items` at index `index` by moving `list[index .. list.len]` to make room.
- Kind
- function
- Module
std.array_list
pub fn insertSliceBounded(self: *Self, index: usize, items: []const T) error
Insert slice `items` at index `index` by moving `list[index .. list.len]` to make room.
- Kind
- function
- Module
std.array_list
pub fn last(self: Self) ?T
Returns the last element from the list, or `null` if the list is empty.
- Kind
- function
- Module
std.array_list
pub fn lastPtr(self: Self) ?*T
Returns a pointer to the last element from the list, or `null` if the list is empty.
- Kind
- function
- Module
std.array_list
pub fn lockPointers(self: *Self) void
Puts the unmanaged array list into a state where any method call that would cause an existing value pointer to become invalidated will instead trigger an assertion. `lockPointers` may be called multiple times.
- Kind
- function
- Module
std.array_list
pub fn orderedRemove(self: *Self, i: usize) T
Remove the element at index `i` from the list and return its value.
- Kind
- function
- Module
std.array_list
pub fn orderedRemoveMany(self: *Self, sorted_indexes: []const usize) void
Remove the elements indexed by `sorted_indexes`.
- Kind
- function
- Module
std.array_list
pub fn pop(self: *Self) ?T
Remove and return the last element from the list.
- Kind
- function
- Module
std.array_list
pub fn print(self: *Self, gpa: Allocator, comptime fmt: []const u8, args: anytype) error
Prints a formatted string into this list.
- Kind
- function
- Module
std.array_list
pub fn printAssumeCapacity(self: *Self, comptime fmt: []const u8, args: anytype) void
Prints a formatted string into this list.
- Kind
- function
- Module
std.array_list
pub fn printBounded(self: *Self, comptime fmt: []const u8, args: anytype) error
Prints a formatted string into this list.
- Kind
- function
- Module
std.array_list
pub fn replaceRange(self: *Self, gpa: Allocator, start: usize, len: usize, new_items: []const T) Allocator.Error!void
Grows or shrinks the list as necessary.
- Kind
- function
- Module
std.array_list
pub fn replaceRangeAssumeCapacity(self: *Self, start: usize, len: usize, new_items: []const T) void
Grows or shrinks the list as necessary.
- Kind
- function
- Module
std.array_list
pub fn replaceRangeBounded(self: *Self, start: usize, len: usize, new_items: []const T) error
Invalidates pointers to elements at and above index `start + len` when `len` and `new_items.len` are unequal.
- Kind
- function
- Module
std.array_list
pub fn resize(self: *Self, gpa: Allocator, new_len: usize) Allocator.Error!void
Adjust the list length to `new_len`.
- Kind
- function
- Module
std.array_list
pub fn SentinelSlice(comptime s: T) type
- Kind
- type function
- Module
std.array_list
pub fn shrinkAndFree(self: *Self, gpa: Allocator, new_len: usize) void
Reduce allocated capacity to `new_len`.
- Kind
- function
- Module
std.array_list
pub fn shrinkAndFreePrecise(self: *Self, gpa: Allocator, new_len: usize) Allocator.Error!void
Reduce allocated capacity to `new_len`.
- Kind
- function
- Module
std.array_list
pub fn shrinkRetainingCapacity(self: *Self, new_len: usize) void
Reduce length to `new_len`.
- Kind
- function
- Module
std.array_list
pub fn shrinkToLen(self: *Self, gpa: Allocator) Allocator.Error!void
Shrinks capacity to match length.
- Kind
- function
- Module
std.array_list
pub fn shrinkToLenSentinel(self: *Self, gpa: Allocator) Allocator.Error!void
Shrinks or expands capacity to match length + 1.
- Kind
- function
- Module
std.array_list
- Kind
- type
- Module
std.array_list
pub fn swapRemove(self: *Self, i: usize) T
Removes the element at the specified index and returns it.
- Kind
- function
- Module
std.array_list
pub fn toManaged(self: *Self, gpa: Allocator) AlignedManaged(T, alignment)
Convert this list into an analogous memory-managed one.
- Kind
- function
- Module
std.array_list
pub fn toOwnedSlice(self: *Self, gpa: Allocator) Allocator.Error!Slice
The caller owns the returned memory.
- Kind
- function
- Module
std.array_list
pub fn toOwnedSliceAssert(self: *Self) Slice
The caller owns the returned memory.
- Kind
- function
- Module
std.array_list
pub fn toOwnedSliceSentinel(self: *Self, gpa: Allocator, comptime sentinel: T) Allocator.Error!SentinelSlice(sentinel)
The caller owns the returned memory.
- Kind
- function
- Module
std.array_list
pub fn toOwnedSliceSentinelAssert(self: *Self, comptime sentinel: T) SentinelSlice(sentinel)
The caller owns the returned memory.
- Kind
- function
- Module
std.array_list
pub fn unlockPointers(self: *Self) void
Undoes one call to `lockPointers`.
- Kind
- function
- Module
std.array_list
pub fn unusedCapacitySlice(self: Self) []T
Returns a slice of only the extra capacity after items.
- Kind
- function
- Module
std.array_list