--- a/docs/Writerside/topics/map.h.md Fri Nov 07 19:23:21 2025 +0100 +++ b/docs/Writerside/topics/map.h.md Sat Nov 08 23:45:19 2025 +0100 @@ -300,6 +300,8 @@ cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); + +int cxMapCloneSimple(CxMap *dst, const CxMap *src); int cxMapDifference(CxMap *dst, const CxMap *minuend, const CxMap *subtrahend, @@ -307,28 +309,42 @@ const CxAllocator *clone_allocator, void *data); +int cxMapDifferenceSimple(CxMap *dst, + const CxMap *minuend, const CxMap *subtrahend); + int cxMapListDifference(CxMap *dst, const CxMap *src, const CxList *keys, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); +int cxMapListDifferenceSimple(CxMap *dst, + const CxMap *src, const CxList *keys); + int cxMapIntersection(CxMap *dst, const CxMap *src, const CxMap *other, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); +int cxMapIntersectionSimple(CxMap *dst, + const CxMap *src, const CxMap *other); + int cxMapListIntersection(CxMap *dst, const CxMap *src, const CxList *keys, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); +int cxMapListIntersectionSimple(CxMap *dst, + const CxMap *src, const CxList *keys); + int cxMapUnion(CxMap *dst, const CxMap *src, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); + +int cxMapUnionSimple(CxMap *dst, const CxMap *src); ``` With `cxMapClone()` you can create deep copies of the values in one map and insert them into another map. @@ -350,6 +366,10 @@ Refer to the documentation of the [clone-function callback](allocator.h.md#clone-function) to learn how to implement it. +The _simple_ versions of the above functions use an internal shallow clone function +which uses `memcpy()` to copy the values. +If the destination map is storing pointers, this internal clone function uses the current default allocator to allocate the memory. + The functions return zero if and only if all clone operations were successful. > It is perfectly possible to clone items into a map of a different type.