diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-11-17 02:18:56 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-11-17 02:18:56 -0500 |
| commit | c21884e1d64e4193e03be4f3064917a26b34b142 (patch) | |
| tree | 91e09e1df556e260ea2f1b171eaa05bd30646e1f /std/array_list.zig | |
| parent | 2928b01afc5f0d84669ac6a70eedab4117d805f3 (diff) | |
| parent | 704374e51294e14285b0b54030c1cb6154868098 (diff) | |
| download | zig-c21884e1d64e4193e03be4f3064917a26b34b142.tar.gz zig-c21884e1d64e4193e03be4f3064917a26b34b142.zip | |
Merge remote-tracking branch 'origin/master' into llvm8
Diffstat (limited to 'std/array_list.zig')
| -rw-r--r-- | std/array_list.zig | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/std/array_list.zig b/std/array_list.zig index 6f5eeef115..3ee425fe14 100644 --- a/std/array_list.zig +++ b/std/array_list.zig @@ -10,7 +10,7 @@ pub fn ArrayList(comptime T: type) type { } pub fn AlignedArrayList(comptime T: type, comptime A: u29) type { - return struct.{ + return struct { const Self = @This(); /// Use toSlice instead of slicing this directly, because if you don't @@ -22,8 +22,8 @@ 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.{}, + return Self{ + .items = []align(A) T{}, .len = 0, .allocator = allocator, }; @@ -70,7 +70,7 @@ pub fn AlignedArrayList(comptime T: type, comptime A: u29) type { /// allocated with `allocator`. /// Deinitialize with `deinit` or use `toOwnedSlice`. pub fn fromOwnedSlice(allocator: *Allocator, slice: []align(A) T) Self { - return Self.{ + return Self{ .items = slice, .len = slice.len, .allocator = allocator, @@ -179,7 +179,7 @@ pub fn AlignedArrayList(comptime T: type, comptime A: u29) type { return self.pop(); } - pub const Iterator = struct.{ + pub const Iterator = struct { list: *const Self, // how many items have we returned count: usize, @@ -197,7 +197,7 @@ pub fn AlignedArrayList(comptime T: type, comptime A: u29) type { }; pub fn iterator(self: *const Self) Iterator { - return Iterator.{ + return Iterator{ .list = self, .count = 0, }; @@ -251,7 +251,7 @@ test "std.ArrayList.basic" { assert(list.pop() == 10); assert(list.len == 9); - list.appendSlice([]const i32.{ + list.appendSlice([]const i32{ 1, 2, 3, @@ -262,7 +262,7 @@ test "std.ArrayList.basic" { assert(list.pop() == 1); assert(list.len == 9); - list.appendSlice([]const i32.{}) catch unreachable; + list.appendSlice([]const i32{}) catch unreachable; assert(list.len == 9); // can only set on indices < self.len @@ -382,7 +382,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, []const i32{ 9, 8, }); @@ -393,7 +393,7 @@ test "std.ArrayList.insertSlice" { assert(list.items[4] == 3); assert(list.items[5] == 4); - const items = []const i32.{1}; + const items = []const i32{1}; try list.insertSlice(0, items[0..0]); assert(list.len == 6); assert(list.items[0] == 1); |
