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 {
125125 }
126126
127127 /// 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 {
129129 var cloned = try Self.initCapacity(self.allocator, self.capacity);
130130 cloned.appendSliceAssumeCapacity(self.items);
131131 return cloned;
......@@ -560,7 +560,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
560560 }
561561
562562 /// 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 {
564564 var cloned = try Self.initCapacity(allocator, self.capacity);
565565 cloned.appendSliceAssumeCapacity(self.items);
566566 return cloned;