src/cx/map.h

changeset 1474
84de0ba791af
parent 1465
dc886f1a6155
equal deleted inserted replaced
1473:944f02992369 1474:84de0ba791af
581 */ 581 */
582 cx_attr_nonnull_arg(1, 2, 3, 4) 582 cx_attr_nonnull_arg(1, 2, 3, 4)
583 CX_EXPORT int cxMapListIntersection(CxMap *dst, const CxMap *src, const CxList *keys, 583 CX_EXPORT int cxMapListIntersection(CxMap *dst, const CxMap *src, const CxList *keys,
584 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 584 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
585 585
586 /**
587 * Clones entries into a map if their key does not exist yet.
588 *
589 * If you want to calculate the union of two maps into a fresh new map,
590 * you can proceed as follows:
591 * 1. Clone the first map into a fresh, empty map.
592 * 2. Use this function to clone the second map into the result from step 1.
593 *
594 * @param dst the destination map
595 * @param src the map to clone the entries from
596 * @param clone_func the clone function for the values
597 * @param clone_allocator the allocator that is passed to the clone function
598 * @param data optional additional data that is passed to the clone function
599 * @retval zero when the elements were successfully cloned
600 * @retval non-zero when an allocation error occurred
601 */
602 cx_attr_nonnull_arg(1, 2, 3)
603 CX_EXPORT int cxMapUnion(CxMap *dst, const CxMap *src,
604 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
605
586 #ifdef __cplusplus 606 #ifdef __cplusplus
587 } // extern "C" 607 } // extern "C"
588 #endif 608 #endif
589 609
590 #endif // UCX_MAP_H 610 #endif // UCX_MAP_H

mercurial