MapRemoveIf
MapRemoveIf
Description
Remove and destroy all entries that match a predicate.
Parameters
| Name | Direction | Description |
|---|---|---|
m |
in,out | Map. |
predicate_fn |
in | Callback returning true for entries to remove. |
ctx |
in,out | Optional user context passed to the predicate. |
Success
Number of removed pairs.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Map.c:1078:
if (!predicate) {
LOG_FATAL("MapRemoveIf requires a predicate");
}- In
Map.Remove.c:71:
MapInsertR(&map, 3, 31);
bool result = (MapRemoveIf(&map, remove_even_values, NULL) == 2);
result = result && !MapContainsKey(&map, 2);
result = result && (MapValueCountForKey(&map, 1) == 1);
Last updated on