Skip to content

MapRemoveAll

Description

Remove all entries matching a key.

Parameters

Name Direction Description
m in,out Map.
lookup_key in Key to delete.

Success

Returns the count of removed entries (> 0). Every matching slot is now a tombstone; key_copy_deinit / value_copy_deinit (if configured) have been invoked on each removed entry. Map length shrinks by the returned count.

Failure

Returns 0 when no entry matches. The map is not modified.

Usage example (Cross-references)

Usage examples (Cross-references)
        for (int i = 0; i < 4000; ++i) {
            int key = 600 + (i & 0x3f); // small cycling window
            MapRemoveAll(&map, key);
            MapInsertR(&map, key, i);
        }
        MapInsertR(&map, 9, 90);
    
        bool result = (MapRemoveAll(&map, 5) == 3);
        result      = result && !MapContainsKey(&map, 5);
        result      = result && (MapValueCountForKey(&map, 5) == 0);
Last updated on