MapRehashWithPolicy
Description
Remap using a specific probing policy.
Parameters
| Name | Direction | Description |
|---|---|---|
m |
in,out | Hash map. |
n |
in | Minimum number of entries expected after rehash. |
Success
Returns true. The map is rebuilt with the new probing policy (copied into the map by value), sized to fit at least n entries plus the current length. Every live entry has been re-hashed under the new policy; tombstones are gone.
Failure
Returns false on allocation failure during the new probe table build. The map and its existing policy are unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Map.Init.c:89:
}
MapRehashWithPolicy(&map, MapPairCount(&map), MapPolicyQuadratic);
bool result = (MapPolicy(&map).first_index == MapPolicyQuadratic.first_index) &&- In
Map.Ops.c:89:
MapSetOnlyR(&map, "yellow", "banana");
MapSetOnlyR(&map, "green", "pear");
MapRehashWithPolicy(&map, MapPairCount(&map), MapPolicyQuadratic);
bool result = (MapPolicy(&map).first_index == MapPolicyQuadratic.first_index) &&- In
Memory.h:161:
#define MapMustRehashWithPolicy(m, n, policy_value) \
do { \
if (!MapRehashWithPolicy((m), (n), (policy_value))) { \
LOG_FATAL("MapMustRehashWithPolicy failed"); \
} \
Last updated on