src/cx/list.h

changeset 1477
9170a7dff573
parent 1468
0f4d90a1ae23
equal deleted inserted replaced
1476:79d4c281a63b 1477:9170a7dff573
976 * @param clone_func the clone function for the elements 976 * @param clone_func the clone function for the elements
977 * @param clone_allocator the allocator that is passed to the clone function 977 * @param clone_allocator the allocator that is passed to the clone function
978 * @param data optional additional data that is passed to the clone function 978 * @param data optional additional data that is passed to the clone function
979 * @retval zero when all elements were successfully cloned 979 * @retval zero when all elements were successfully cloned
980 * @retval non-zero when an allocation error occurred 980 * @retval non-zero when an allocation error occurred
981 * @see cxListUnion()
981 */ 982 */
982 cx_attr_nonnull_arg(1, 2, 3) 983 cx_attr_nonnull_arg(1, 2, 3)
983 CX_EXPORT int cxListClone(CxList *dst, const CxList *src, 984 CX_EXPORT int cxListClone(CxList *dst, const CxList *src,
984 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 985 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
985 986
1007 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 1008 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
1008 1009
1009 /** 1010 /**
1010 * Clones elements from a list only if they are also present in another list. 1011 * Clones elements from a list only if they are also present in another list.
1011 * 1012 *
1012 * This function is optimized for the case when both the @p minuend and the 1013 * This function is optimized for the case when both the @p src and the
1013 * @p subtrahend are sorted. 1014 * @p other list are sorted.
1014 * 1015 *
1015 * If the destination list already contains elements, the intersection is appended 1016 * If the destination list already contains elements, the intersection is appended
1016 * to that list. 1017 * to that list.
1017 * 1018 *
1018 * @param dst the destination list 1019 * @param dst the destination list
1026 */ 1027 */
1027 cx_attr_nonnull_arg(1, 2, 3, 4) 1028 cx_attr_nonnull_arg(1, 2, 3, 4)
1028 CX_EXPORT int cxListIntersection(CxList *dst, const CxList *src, const CxList *other, 1029 CX_EXPORT int cxListIntersection(CxList *dst, const CxList *src, const CxList *other,
1029 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); 1030 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
1030 1031
1032 /**
1033 * Performs a deep clone of one list into another, skipping duplicates.
1034 *
1035 * This function is optimized for the case when both the @p src and the
1036 * @p other list are sorted.
1037 * In that case, the union will also be sorted.
1038 *
1039 * If the destination list already contains elements, the union is appended
1040 * to that list. In that case the destination is not necessarily sorted.
1041 *
1042 * @param dst the destination list
1043 * @param src the primary source list
1044 * @param other the other list, where elements are only cloned from
1045 * when they are not in @p src
1046 * @param clone_func the clone function for the elements
1047 * @param clone_allocator the allocator that is passed to the clone function
1048 * @param data optional additional data that is passed to the clone function
1049 * @retval zero when the elements were successfully cloned
1050 * @retval non-zero when an allocation error occurred
1051 * @see cxListClone()
1052 */
1053 cx_attr_nonnull_arg(1, 2, 3, 4)
1054 CX_EXPORT int cxListUnion(CxList *dst, const CxList *src, const CxList *other,
1055 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data);
1056
1057
1031 #ifdef __cplusplus 1058 #ifdef __cplusplus
1032 } // extern "C" 1059 } // extern "C"
1033 #endif 1060 #endif
1034 1061
1035 #endif // UCX_LIST_H 1062 #endif // UCX_LIST_H

mercurial