--- a/src/cx/list.h Mon Oct 20 20:38:02 2025 +0200 +++ b/src/cx/list.h Tue Oct 21 17:06:17 2025 +0200 @@ -961,6 +961,27 @@ CX_EXPORT void cxListFree(CxList *list); +/** + * Performs a deep clone of one list into another. + * + * If the destination list already contains elements, the cloned elements + * are appended to that list. + * + * @attention If the cloned elements need to be destroyed by a destructor + * function, you must make sure that the destination list also uses this + * destructor function. + * + * @param dst the destination list + * @param src the source list + * @param clone_func the clone function for the elements + * @param clone_allocator the allocator that is passed to the clone function + * @param data optional additional data that is passed to the clone function + * @return the number of elements that have been successfully cloned + */ +cx_attr_nonnull_arg(1, 2, 3) +CX_EXPORT size_t cxListClone(CxList *dst, const CxList *src, + cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); + #ifdef __cplusplus } // extern "C" #endif