--- a/src/cx/map.h Sun Oct 26 11:50:33 2025 +0100 +++ b/src/cx/map.h Sun Oct 26 12:01:28 2025 +0100 @@ -508,10 +508,38 @@ cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); +/** + * Clones entries of a map if their key is not present in another map. + * + * @param dst the destination map + * @param minuend the map to subtract the entries from + * @param subtrahend the map containing the elements to be subtracted + * @param clone_func the clone function for the values + * @param clone_allocator the allocator that is passed to the clone function + * @param data optional additional data that is passed to the clone function + * @retval zero when the elements were successfully cloned + * @retval non-zero when an allocation error occurred + */ cx_attr_nonnull_arg(1, 2, 3, 4) CX_EXPORT int cxMapDifference(CxMap *dst, const CxMap *minuend, const CxMap *subtrahend, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); +/** + * Clones entries of a map if their key is not present in a list. + * + * Note that the list must contain keys of type @c CxKey + * (or pointers to such keys). + * Generic key types cannot be processed in this case. + * + * @param dst the destination map + * @param src the source map + * @param keys the list of @c CxKey items + * @param clone_func the clone function for the values + * @param clone_allocator the allocator that is passed to the clone function + * @param data optional additional data that is passed to the clone function + * @retval zero when the elements were successfully cloned + * @retval non-zero when an allocation error occurred + */ cx_attr_nonnull_arg(1, 2, 3, 4) CX_EXPORT int cxMapListDifference(CxMap *dst, const CxMap *src, const CxList *keys, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);