diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 444de30162..64f13eff9b 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -71,6 +71,11 @@ pub fn AlignedArrayList(comptime T: type, comptime alignment: ?u29) type { return self.toSliceConst()[i]; } + /// Safely access ptr to index i of the list. + pub fn ptrAt(self: Self, i: usize) *T { + return &self.toSlice()[i]; + } + /// Sets the value at index `i`, or returns `error.OutOfBounds` if /// the index is not in range. pub fn setOrError(self: Self, i: usize, item: T) !void {