Skip to content

cf_map_keys

Category: map
GitHub: cute_map.h


Get a pointer to the array of keys.

#define cf_map_keys(m) map_keys(m)
Parameters Description
m The map. Can be NULL. Must be declared with CF_MAP(T).

Return Value

Returns uint64_t* pointing to the keys array, or NULL if map is empty.

Code Example

Loop over all {key, item} pairs.

CF_MAP(CF_V2) table = my_table();
uint64_t* keys = map_keys(table);
for (int i = 0; i < map_size(table); ++i) {
    uint64_t key = keys[i];
    CF_V2 item = table[i];
    // ...
}

Remarks

The keys array is parallel to the items array. Use with map_size for iteration bounds.

CF_MAP
cf_map_set
cf_map_get
cf_map_get_ptr
cf_map_has
cf_map_del
cf_map_clear
cf_map_items
cf_map_swap
cf_map_size
cf_map_free