docs/Writerside/topics/map.h.md

changeset 1465
dc886f1a6155
parent 1447
aaf85b3e9601
equal deleted inserted replaced
1464:9a10af83cfab 1465:dc886f1a6155
310 int cxMapListDifference(CxMap *dst, 310 int cxMapListDifference(CxMap *dst,
311 const CxMap *src, const CxList *keys, 311 const CxMap *src, const CxList *keys,
312 cx_clone_func clone_func, 312 cx_clone_func clone_func,
313 const CxAllocator *clone_allocator, 313 const CxAllocator *clone_allocator,
314 void *data); 314 void *data);
315
316 int cxMapIntersection(CxMap *dst,
317 const CxMap *src, const CxMap *other,
318 cx_clone_func clone_func,
319 const CxAllocator *clone_allocator,
320 void *data);
321
322 int cxMapListIntersection(CxMap *dst,
323 const CxMap *src, const CxList *keys,
324 cx_clone_func clone_func,
325 const CxAllocator *clone_allocator,
326 void *data);
315 ``` 327 ```
316 328
317 With `cxMapClone()` you can create deep copies of the values in one map and insert them into another map. 329 With `cxMapClone()` you can create deep copies of the values in one map and insert them into another map.
318 The destination map does not need to be empty. 330 The destination map does not need to be empty.
319 But when a key already exists in the destination map, the value is overwritten with the clone from the source map. 331 But when a key already exists in the destination map, the value is overwritten with the clone from the source map.
321 333
322 The functions `cxMapDifference()` and `cxMapListDifference()` are similar to `cxMapClone()` 334 The functions `cxMapDifference()` and `cxMapListDifference()` are similar to `cxMapClone()`
323 except that they only clone an element from the source map, when the key is _not_ contained in the 335 except that they only clone an element from the source map, when the key is _not_ contained in the
324 other map (or list, respectively). 336 other map (or list, respectively).
325 This is equivalent to computing the set difference for the set of keys. 337 This is equivalent to computing the set difference for the set of keys.
338 Likewise, `cxMapIntersection()` and `cxMapListIntersection()` only clone an element from the source map,
339 when the key is contained in _both_ collections.
326 340
327 Refer to the documentation of the [clone-function callback](allocator.h.md#clone-function) to learn how to implement it. 341 Refer to the documentation of the [clone-function callback](allocator.h.md#clone-function) to learn how to implement it.
328 342
329 The functions return zero if and only if all clone operations were successful. 343 The functions return zero if and only if all clone operations were successful.
330 344

mercurial