diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-06-09 19:44:01 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-06-09 19:44:01 -0400 |
| commit | 3a4b749c8a1124734c3202ec0d6f4f6566e7dc7e (patch) | |
| tree | d02ca4c7ff46abf748fa175a68d13eccebb97a92 /std/array_list.zig | |
| parent | 59fe13772f63838a84ac1786c0dc8361cd14b99d (diff) | |
| parent | b735764898412c5b9388fdf729c8ad8db43ddde5 (diff) | |
| download | zig-3a4b749c8a1124734c3202ec0d6f4f6566e7dc7e.tar.gz zig-3a4b749c8a1124734c3202ec0d6f4f6566e7dc7e.zip | |
Merge remote-tracking branch 'origin/master' into copy-elision-3
Diffstat (limited to 'std/array_list.zig')
| -rw-r--r-- | std/array_list.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/std/array_list.zig b/std/array_list.zig index ca7d5f911e..ee282145bd 100644 --- a/std/array_list.zig +++ b/std/array_list.zig @@ -23,7 +23,7 @@ pub fn AlignedArrayList(comptime T: type, comptime A: u29) type { /// Deinitialize with `deinit` or use `toOwnedSlice`. pub fn init(allocator: *Allocator) Self { return Self{ - .items = []align(A) T{}, + .items = [_]T{}, .len = 0, .allocator = allocator, }; @@ -265,7 +265,7 @@ test "std.ArrayList.basic" { testing.expect(list.pop() == 10); testing.expect(list.len == 9); - list.appendSlice([]const i32{ + list.appendSlice([_]i32{ 1, 2, 3, @@ -276,7 +276,7 @@ test "std.ArrayList.basic" { testing.expect(list.pop() == 1); testing.expect(list.len == 9); - list.appendSlice([]const i32{}) catch unreachable; + list.appendSlice([_]i32{}) catch unreachable; testing.expect(list.len == 9); // can only set on indices < self.len @@ -423,7 +423,7 @@ test "std.ArrayList.insertSlice" { try list.append(2); try list.append(3); try list.append(4); - try list.insertSlice(1, []const i32{ + try list.insertSlice(1, [_]i32{ 9, 8, }); @@ -434,7 +434,7 @@ test "std.ArrayList.insertSlice" { testing.expect(list.items[4] == 3); testing.expect(list.items[5] == 4); - const items = []const i32{1}; + const items = [_]i32{1}; try list.insertSlice(0, items[0..0]); testing.expect(list.len == 6); testing.expect(list.items[0] == 1); |
