Skip to content

MapCapacity

Description

Probe-table slot count: the size of the underlying open-addressed hash table, including occupied slots, tombstones, and empty slots. Grows with the policy’s next_capacity. Always >= MapPairCount(m).

Parameters

Name Direction Description
m in Map.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        MapReserve(&map, 32);
        reserved_capacity = (size)MapCapacity(&map);
    
        MapInsertR(&map, 1, 10);
        MapClear(&map);
    
        bool result = (reserved_capacity >= 32) && (MapCapacity(&map) == reserved_capacity) && (MapTombstones(&map) == 0) &&
                      (MapPairCount(&map) == 0) && MapEmpty(&map) && !MapContainsKey(&map, 1) && !MapContainsKey(&map, 2);
        }
    
        result = result && (MapCapacity(&map) == 10);
        result = result && (map.policy.next_capacity == custom_next_capacity);
    
        bool result =
            MapPairCount(&map) == 0 && MapCapacity(&map) == 0 && MapTombstones(&map) == 0 && MapEntries(&map) == NULL &&
            MapStates(&map) == NULL && map.key_compare == i32_compare && map.value_compare == NULL &&
            map.key_hash == i32_hash && map.policy.should_rehash == MapPolicyLinear.should_rehash &&
Last updated on