--- a/docs/Writerside/topics/array_list.h.md Thu Dec 18 18:07:29 2025 +0100 +++ b/docs/Writerside/topics/array_list.h.md Fri Dec 19 12:40:58 2025 +0100 @@ -118,6 +118,28 @@ > with `cx_array_copy_to_new()` or `cx_array_copy_to_new_a()` before adding or inserting more elements. >{style="note"} +## Remove Elements + +```C +#include <cx/array_list.h> + +void cx_array_remove(CxArray array, size_t index); + +void cx_array_remove_fast(CxArray array, size_t index); + +void cx_array_remove_array(CxArray array, size_t index, size_t n); + +void cx_array_remove_array_fast(CxArray array, size_t index, size_t n); +``` + +The functions `cx_array_remove()` and `cx_array_remove_array()` remove one or more elements from the array by shifting the remaining elements by the number of removed elements. +The functions `cx_array_remove_fast()` and `cx_array_remove_array_fast()` on the other hand copy elements from the end of the array into the gap to fill the removed elements. +Therefore, if the order of the elements does not matter, you can use the fast versions of these functions for better performance. + +> When you specify an `index` that is out-of-bounds or choose a number `n` of elements that would overflow the array, +> the above functions only remove as many elements as possible. +> So it's safe to use them without any bounds checking. + ## Sorting ```C