diff options
Diffstat (limited to 'lib/std/array_list.zig')
| -rw-r--r-- | lib/std/array_list.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 2510973692..24098a01f6 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -618,6 +618,8 @@ pub fn ArrayListUnmanaged(comptime T: type) type { /// Functions that potentially allocate memory accept an `Allocator` parameter. /// Initialize directly or with `initCapacity`, and deinitialize with `deinit` /// or use `toOwnedSlice`. +/// +/// Default initialization of this struct is deprecated; use `.empty` instead. pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) type { if (alignment) |a| { if (a == @alignOf(T)) { @@ -638,6 +640,12 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ /// additional memory. capacity: usize = 0, + /// An ArrayList containing no elements. + pub const empty: Self = .{ + .items = &.{}, + .capacity = 0, + }; + pub const Slice = if (alignment) |a| ([]align(a) T) else []T; pub fn SentinelSlice(comptime s: T) type { |
