diff -r bba2e5efdca0 -r ac1baaed2fd7 src/list.c --- a/src/list.c Fri Nov 07 19:23:21 2025 +0100 +++ b/src/list.c Sat Nov 08 23:45:19 2025 +0100 @@ -819,6 +819,15 @@ list->collection.advanced_destructor = destr2_bak; } +static void* cx_list_simple_clone_func(void *dst, const void *src, const CxAllocator *al, void *data) { + size_t elem_size = *(size_t*)data; + if (dst == NULL) dst = cxMalloc(al, elem_size); + if (dst != NULL) memcpy(dst, src, elem_size); + return dst; +} + +#define use_simple_clone_func(list) cx_list_simple_clone_func, NULL, (void*)&((list)->collection.elem_size) + int cxListClone(CxList *dst, const CxList *src, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data) { if (clone_allocator == NULL) clone_allocator = cxDefaultAllocator; @@ -1078,3 +1087,19 @@ return 0; } + +int cxListCloneSimple(CxList *dst, const CxList *src) { + return cxListClone(dst, src, use_simple_clone_func(src)); +} + +int cxListDifferenceSimple(CxList *dst, const CxList *minuend, const CxList *subtrahend) { + return cxListDifference(dst, minuend, subtrahend, use_simple_clone_func(minuend)); +} + +int cxListIntersectionSimple(CxList *dst, const CxList *src, const CxList *other) { + return cxListIntersection(dst, src, other, use_simple_clone_func(src)); +} + +int cxListUnionSimple(CxList *dst, const CxList *src, const CxList *other) { + return cxListUnion(dst, src, other, use_simple_clone_func(src)); +}