DoxigAlpha

orderedRemove

Remove the specified item from the list, shifting items after it to preserve order.

Function parameters

Parameters

#
self:*Self
index:usize

A MultiArrayList stores a list of a struct or tagged union type.

Functions

#
MultiArrayList
A MultiArrayList stores a list of a struct or tagged union type.

Source

Implementation

#
pub fn orderedRemove(self: *Self, index: usize) void {
    const slices = self.slice();
    inline for (fields, 0..) |_, field_index| {
        const field_slice = slices.items(@as(Field, @enumFromInt(field_index)));
        var i = index;
        while (i < self.len - 1) : (i += 1) {
            field_slice[i] = field_slice[i + 1];
        }
        field_slice[i] = undefined;
    }
    self.len -= 1;
}