| 981 */ |
981 */ |
| 982 cx_attr_nonnull_arg(1, 2, 3) |
982 cx_attr_nonnull_arg(1, 2, 3) |
| 983 CX_EXPORT int cxListClone(CxList *dst, const CxList *src, |
983 CX_EXPORT int cxListClone(CxList *dst, const CxList *src, |
| 984 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
984 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
| 985 |
985 |
| |
986 /** |
| |
987 * Clones elements from a list only if they are not present in another list. |
| |
988 * |
| |
989 * If the @p minuend does not contain duplicates, this is equivalent to adding |
| |
990 * the set difference to the destination list. |
| |
991 * |
| |
992 * If the destination list already contains elements, the difference |
| |
993 * (@p dst + @p minuend) - @p subtrahend is calculated. |
| |
994 * New items for @p dst are always appendend to the list, which means that the |
| |
995 * destination list is not necessarily sorted. |
| |
996 * |
| |
997 * This function is optimized for the case when both the @p minuend and the |
| |
998 * @p subtrahend are sorted. |
| |
999 * |
| |
1000 * @param dst the destination list |
| |
1001 * @param minuend the list to subtract elements from |
| |
1002 * @param subtrahend the elements that shall be subtracted |
| |
1003 * @param clone_func the clone function for the elements |
| |
1004 * @param clone_allocator the allocator that is passed to the clone function |
| |
1005 * @param data optional additional data that is passed to the clone function |
| |
1006 * @retval zero when the elements were successfully cloned |
| |
1007 * @retval non-zero when an allocation error occurred |
| |
1008 */ |
| |
1009 cx_attr_nonnull_arg(1, 2, 3) |
| |
1010 CX_EXPORT int cxListDifference(CxList *dst, |
| |
1011 const CxList *minuend, const CxList *subtrahend, |
| |
1012 cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data); |
| |
1013 |
| 986 #ifdef __cplusplus |
1014 #ifdef __cplusplus |
| 987 } // extern "C" |
1015 } // extern "C" |
| 988 #endif |
1016 #endif |
| 989 |
1017 |
| 990 #endif // UCX_LIST_H |
1018 #endif // UCX_LIST_H |