pub fn swapRemove(self: *Self, index: usize) void self: *Selfindex: usize387
388
389
390
391
392
393
394
395 pub fn swapRemove(self: *Self, index: usize) void {
const slices = self.slice();
inline for (field_names, 0..) |_, i| {
const field_slice = slices.items(@as(Field, @fromBackingInt(@intCast(i))));
field_slice[index] = field_slice[self.len - 1];
field_slice[self.len - 1] = undefined;
}
self.len -= 1;
}
Remove the specified item from the list, swapping the last item in the list into its position. Fast, but does not retain list ordering.