462 * @see cxMapRemove() |
462 * @see cxMapRemove() |
463 * @see CX_HASH_KEY() |
463 * @see CX_HASH_KEY() |
464 */ |
464 */ |
465 #define cxMapRemoveAndGet(map, key, targetbuf) cx_map_remove(map, CX_HASH_KEY(key), targetbuf) |
465 #define cxMapRemoveAndGet(map, key, targetbuf) cx_map_remove(map, CX_HASH_KEY(key), targetbuf) |
466 |
466 |
|
467 |
|
468 /** |
|
469 * Performs a deep clone of one map into another. |
|
470 * |
|
471 * If the destination map already contains entries, the cloned entries |
|
472 * are added to that map, possibly overwriting existing elements when |
|
473 * the keys already exist. |
|
474 * |
|
475 * When elements in the destination map need to be replaced, any destructor |
|
476 * function is called on the replaced elements before replacing them. |
|
477 * |
|
478 * @attention If the cloned elements need to be destroyed by a destructor |
|
479 * function, you must make sure that the destination map also uses this |
|
480 * destructor function. |
|
481 * |
|
482 * @param dst the destination map |
|
483 * @param src the source map |
|
484 * @param clone_func the clone function for the values |
|
485 * @param clone_allocator the allocator that is passed to the clone function |
|
486 * @param data optional additional data that is passed to the clone function |
|
487 * @return the number of elements that have been successfully cloned |
|
488 */ |
|
489 cx_attr_nonnull_arg(1, 2, 3) |
|
490 CX_EXPORT size_t cxMapClone(CxMap *dst, const CxMap *src, |
|
491 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
|
492 |
467 #ifdef __cplusplus |
493 #ifdef __cplusplus |
468 } // extern "C" |
494 } // extern "C" |
469 #endif |
495 #endif |
470 |
496 |
471 #endif // UCX_MAP_H |
497 #endif // UCX_MAP_H |