--- a/docs/Writerside/topics/array_list.h.md Fri Oct 10 12:26:43 2025 +0200 +++ b/docs/Writerside/topics/array_list.h.md Fri Oct 10 17:24:19 2025 +0200 @@ -217,6 +217,8 @@ ## Insertion Sort ```C +#include <cx/array_list.h> + int cx_array_insert_sorted( void **target, size_t *size, size_t *capacity, cx_compare_func cmp_func, @@ -251,6 +253,36 @@ The convenience macros are all calling `cx_array_insert_sorted()` by deducing the missing arguments. The `cx_array_add_sorted()` family of macros are interpreting the `elem` as a `src` array with an `elem_count` of one. +## Sets of Unique Elements + +```C +#include <cx/array_list.h> + +int cx_array_insert_unique( + void **target, size_t *size, size_t *capacity, + cx_compare_func cmp_func, + const void *src, size_t elem_size, size_t elem_count, + CxArrayReallocator *reallocator); + +#define cx_array_simple_insert_unique(ARRAY, + src, elem_count, cmp_func) + +#define cx_array_simple_insert_unique_a(reallocator, ARRAY, + src, elem_count, cmp_func) + +#define cx_array_add_unique(target, size, capacity, + elem_size, elem, cx_compare_func cmp_func, reallocator); + +#define cx_array_simple_add_unique(ARRAY, + elem, cmp_func) + +#define cx_array_simple_add_unique_a(reallocator, ARRAY, + elem, cmp_func) +``` + +The above functions are similar to `cx_array_insert_sorted()` and its [relatives](#insertion-sort), +except that they skip insertion of elements that are already present in the target array. + ## Binary Search ```C