authorgravatar for john.schmidt.h@gmail.comJohn Schmidt <john.schmidt.h@gmail.com> 2021-12-16 10:55:35+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-01-27 19:35:08+02:00
log997600ac6f8683a9c0935143dd345602bd4a8889
tree86a731d97258cd3e4fa3f482b57b0edb8eaa0b13
parentf04007028ff0e9bc34267c5f0f27985917748496

Preserve alignment when cloning


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

lib/std/array_list.zig+2-2
...@@ -110,7 +110,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {...@@ -110,7 +110,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
110110
111 /// Creates a copy of this ArrayList, using the same allocator.111 /// Creates a copy of this ArrayList, using the same allocator.
112 pub fn clone(self: *Self) !Self {112 pub fn clone(self: *Self) !Self {
113 var cloned = try ArrayList(T).initCapacity(self.allocator, self.capacity);113 var cloned = try Self.initCapacity(self.allocator, self.capacity);
114 cloned.appendSliceAssumeCapacity(self.items);114 cloned.appendSliceAssumeCapacity(self.items);
115 return cloned;115 return cloned;
116 }116 }
...@@ -498,7 +498,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ...@@ -498,7 +498,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
498498
499 /// Creates a copy of this ArrayList.499 /// Creates a copy of this ArrayList.
500 pub fn clone(self: *Self, allocator: Allocator) !Self {500 pub fn clone(self: *Self, allocator: Allocator) !Self {
501 var cloned = try ArrayListUnmanaged(T).initCapacity(allocator, self.capacity);501 var cloned = try Self.initCapacity(allocator, self.capacity);
502 cloned.appendSliceAssumeCapacity(self.items);502 cloned.appendSliceAssumeCapacity(self.items);
503 return cloned;503 return cloned;
504 }504 }