| ... | @@ -420,7 +420,8 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { | ... | @@ -420,7 +420,8 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { |
| 420 | self.capacity = 0; | 420 | self.capacity = 0; |
| 421 | } | 421 | } |
| 422 | | 422 | |
| 423 | /// Modify the array so that it can hold at least `new_capacity` items. | 423 | /// If the current capacity is less than `new_capacity`, this function will |
| | 424 | /// modify the array so that it can hold at least `new_capacity` items. |
| 424 | /// Invalidates pointers if additional memory is needed. | 425 | /// Invalidates pointers if additional memory is needed. |
| 425 | pub fn ensureTotalCapacity(self: *Self, new_capacity: usize) Allocator.Error!void { | 426 | pub fn ensureTotalCapacity(self: *Self, new_capacity: usize) Allocator.Error!void { |
| 426 | if (@sizeOf(T) == 0) { | 427 | if (@sizeOf(T) == 0) { |
| ... | @@ -434,9 +435,8 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { | ... | @@ -434,9 +435,8 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { |
| 434 | return self.ensureTotalCapacityPrecise(better_capacity); | 435 | return self.ensureTotalCapacityPrecise(better_capacity); |
| 435 | } | 436 | } |
| 436 | | 437 | |
| 437 | /// Modify the array so that it can hold `new_capacity` items. | 438 | /// If the current capacity is less than `new_capacity`, this function will |
| 438 | /// Like `ensureTotalCapacity`, but the resulting capacity is guaranteed | 439 | /// modify the array so that it can hold exactly `new_capacity` items. |
| 439 | /// to be equal to `new_capacity`. | | |
| 440 | /// Invalidates pointers if additional memory is needed. | 440 | /// Invalidates pointers if additional memory is needed. |
| 441 | pub fn ensureTotalCapacityPrecise(self: *Self, new_capacity: usize) Allocator.Error!void { | 441 | pub fn ensureTotalCapacityPrecise(self: *Self, new_capacity: usize) Allocator.Error!void { |
| 442 | if (@sizeOf(T) == 0) { | 442 | if (@sizeOf(T) == 0) { |
| ... | @@ -985,7 +985,8 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ | ... | @@ -985,7 +985,8 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ |
| 985 | self.capacity = 0; | 985 | self.capacity = 0; |
| 986 | } | 986 | } |
| 987 | | 987 | |
| 988 | /// Modify the array so that it can hold at least `new_capacity` items. | 988 | /// If the current capacity is less than `new_capacity`, this function will |
| | 989 | /// modify the array so that it can hold at least `new_capacity` items. |
| 989 | /// Invalidates pointers if additional memory is needed. | 990 | /// Invalidates pointers if additional memory is needed. |
| 990 | pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_capacity: usize) Allocator.Error!void { | 991 | pub fn ensureTotalCapacity(self: *Self, allocator: Allocator, new_capacity: usize) Allocator.Error!void { |
| 991 | if (self.capacity >= new_capacity) return; | 992 | if (self.capacity >= new_capacity) return; |
| ... | @@ -994,9 +995,8 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ | ... | @@ -994,9 +995,8 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ |
| 994 | return self.ensureTotalCapacityPrecise(allocator, better_capacity); | 995 | return self.ensureTotalCapacityPrecise(allocator, better_capacity); |
| 995 | } | 996 | } |
| 996 | | 997 | |
| 997 | /// Modify the array so that it can hold `new_capacity` items. | 998 | /// If the current capacity is less than `new_capacity`, this function will |
| 998 | /// Like `ensureTotalCapacity`, but the resulting capacity is guaranteed | 999 | /// modify the array so that it can hold exactly `new_capacity` items. |
| 999 | /// to be equal to `new_capacity`. | | |
| 1000 | /// Invalidates pointers if additional memory is needed. | 1000 | /// Invalidates pointers if additional memory is needed. |
| 1001 | pub fn ensureTotalCapacityPrecise(self: *Self, allocator: Allocator, new_capacity: usize) Allocator.Error!void { | 1001 | pub fn ensureTotalCapacityPrecise(self: *Self, allocator: Allocator, new_capacity: usize) Allocator.Error!void { |
| 1002 | if (@sizeOf(T) == 0) { | 1002 | if (@sizeOf(T) == 0) { |