diff options
| author | Loris Cro <kappaloris@gmail.com> | 2023-04-25 20:03:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-25 20:03:53 +0200 |
| commit | 015ea6fd6c0c0deacb42de237f737d208737e3ac (patch) | |
| tree | 33f5e2d3acacc24e63f259ce5485fee28243ed44 /lib/std/array_list.zig | |
| parent | a260fa8bf22b952e96b08c3f206756e1784ce870 (diff) | |
| parent | 8d88dcdc61c61e3410138f4402482131f5074a80 (diff) | |
| download | zig-015ea6fd6c0c0deacb42de237f737d208737e3ac.tar.gz zig-015ea6fd6c0c0deacb42de237f737d208737e3ac.zip | |
Merge branch 'master' into autodoc-pkg-mod
Diffstat (limited to 'lib/std/array_list.zig')
| -rw-r--r-- | lib/std/array_list.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 205649ae4d..1695e2bd87 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -221,6 +221,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { /// Asserts the array has at least one item. /// Invalidates pointers to end of list. /// This operation is O(N). + /// This preserves item order. Use `swapRemove` if order preservation is not important. pub fn orderedRemove(self: *Self, i: usize) T { const newlen = self.items.len - 1; if (newlen == i) return self.pop(); @@ -235,6 +236,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { /// Removes the element at the specified index and returns it. /// The empty slot is filled from the end of the list. /// This operation is O(1). + /// This may not preserve item order. Use `orderedRemove` if you need to preserve order. pub fn swapRemove(self: *Self, i: usize) T { if (self.items.len - 1 == i) return self.pop(); |
