MapClear
Description
Clear all entries but retain allocated storage. Entries are deinitialized via the configured key_copy_deinit and value_copy_deinit handlers when present.
Parameters
| Name | Direction | Description |
|---|---|---|
m |
in,out | Hash map. |
Success
Returns to the caller. Length is 0 and all probe slots are marked empty; the entries table and states table remain allocated at the same capacity. When key_copy_deinit / value_copy_deinit are configured they have been invoked on every previously-occupied slot.
Failure
Function cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Ops.c:192:
MapInsertR(&map, 4, 40);
result = result && !MapEmpty(&map);
MapClear(&map);
result = result && MapEmpty(&map);
result = result && (MapPairCount(&map) == 0);- In
Ops.c:303:
MapInsertR(&map, 2, 520);
MapClear(&map);
MapInsertR(&map, 0, 999);- In
Init.c:68:
MapInsertR(&map, 2, 20);
MapRemoveFirst(&map, 1);
MapClear(&map);
bool result = (reserved_capacity >= 32) && (MapCapacity(&map) == reserved_capacity) && (MapTombstones(&map) == 0) &&
Last updated on