Skip to content

MapForeachKey

Description

Iterate once per unique key stored in the multimap.

Parameters

Name Direction Description
m in,out Map to iterate over.
key_var in Name of variable bound to a copy of each unique key.

Success

The loop body runs once for each distinct key (duplicates in the multimap are visited only at their canonical probe-anchor slot) with key_var bound to a copy of that key. The body is skipped when m is empty.

Failure

The macro itself does not fail. LOG_FATAL via ValidateMap(m) when m is uninitialised or corrupted.

Usage example (Cross-references)

Usage examples (Cross-references)
        MapInsertR(&map, 3, 30);
    
        MapForeachKey(&map, key) {
            unique_key_sum += key;
        }
Last updated on