Commit ec67d6e03a
Changed files (1)
lib
lib/std/multi_array_list.zig
@@ -23,6 +23,12 @@ pub fn MultiArrayList(comptime T: type) type {
len: usize = 0,
capacity: usize = 0,
+ pub const empty: Self = .{
+ .bytes = undefined,
+ .len = 0,
+ .capacity = 0,
+ };
+
const Elem = switch (@typeInfo(T)) {
.@"struct" => T,
.@"union" => |u| struct {
@@ -474,7 +480,7 @@ pub fn MultiArrayList(comptime T: type) type {
pub fn swap(sc: @This(), a_index: usize, b_index: usize) void {
inline for (fields, 0..) |field_info, i| {
if (@sizeOf(field_info.type) != 0) {
- const field = @as(Field, @enumFromInt(i));
+ const field: Field = @enumFromInt(i);
const ptr = sc.slice.items(field);
mem.swap(field_info.type, &ptr[a_index], &ptr[b_index]);
}