authorgravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2022-12-04 23:46:32-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-05 04:36:10-05:00
logb1c422776316344489eabf1befd47f7769806376
treeda286acf4460d380dbd08ee9714a5f3e3f058cd2
parent4be1bb4aacfbea422046a7790a5383960a1b97dc

Allow const ArrayLists to be cloned


1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/array_list.zig+2-2
...@@ -125,7 +125,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {...@@ -125,7 +125,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
125 }125 }
126126
127 /// Creates a copy of this ArrayList, using the same allocator.127 /// Creates a copy of this ArrayList, using the same allocator.
128 pub fn clone(self: *Self) Allocator.Error!Self {128 pub fn clone(self: Self) Allocator.Error!Self {
129 var cloned = try Self.initCapacity(self.allocator, self.capacity);129 var cloned = try Self.initCapacity(self.allocator, self.capacity);
130 cloned.appendSliceAssumeCapacity(self.items);130 cloned.appendSliceAssumeCapacity(self.items);
131 return cloned;131 return cloned;
...@@ -560,7 +560,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ...@@ -560,7 +560,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
560 }560 }
561561
562 /// Creates a copy of this ArrayList.562 /// Creates a copy of this ArrayList.
563 pub fn clone(self: *Self, allocator: Allocator) Allocator.Error!Self {563 pub fn clone(self: Self, allocator: Allocator) Allocator.Error!Self {
564 var cloned = try Self.initCapacity(allocator, self.capacity);564 var cloned = try Self.initCapacity(allocator, self.capacity);
565 cloned.appendSliceAssumeCapacity(self.items);565 cloned.appendSliceAssumeCapacity(self.items);
566 return cloned;566 return cloned;