Skip to content

MapCompact

Description

Rebuild the map using the current policy and current pair count. This removes tombstones and re-packs the probe table.

Parameters

Name Direction Description
m in,out Map.

Success

Returns true. Tombstones have been removed and every live entry has been re-hashed into a fresh probe table sized for the current length. Map length is preserved; probe distances may decrease.

Failure

Returns false on allocation failure for the new probe table. The map and existing entries are unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        bool result = (MapTombstones(&first) == 1);
        MapCompact(&first);
    
        result = result && (MapTombstones(&first) == 0);
    #define MapMustCompact(m)                                                                                              \
        do {                                                                                                               \
            if (!MapCompact((m))) {                                                                                        \
                LOG_FATAL("MapMustCompact failed");                                                                        \
            }                                                                                                              \
Last updated on