cf_map_items¶
Category: map
GitHub: cute_map.h
Get a pointer to the array of items (values).
| Parameters | Description |
|---|---|
m |
The map. Can be NULL. Must be declared with CF_MAP(T). |
Return Value¶
Returns the map pointer itself (which points to the items array).
Code Example¶
Loop over all {key, item} pairs.
CF_MAP(CF_V2) table = my_table();
uint64_t* keys = map_keys(table);
CF_V2* items = map_items(table); // Same as just using `table` directly
for (int i = 0; i < map_size(table); ++i) {
uint64_t key = keys[i];
CF_V2 item = items[i]; // Or just: table[i]
// ...
}
Remarks¶
Since CF_MAP(T) is T*, the map pointer itself is already the items array. This macro exists
for symmetry with map_keys and clarity in iteration code.
Related Pages¶
CF_MAP
cf_map_set
cf_map_get
cf_map_get_ptr
cf_map_has
cf_map_del
cf_map_clear
cf_map_keys
cf_map_swap
cf_map_size
cf_map_free