Skip to content

hitems

Category: hash
GitHub: cute_hashtable.h


Get a pointer to the array of items.

#define hitems(h) cf_hashtable_items(h)
Parameters Description
h The hashtable. Can be NULL. Needs to be a pointer to the type of items in the table.

Code Example

Loop over all {key, item} pairs of a table.

htbl CF_V2 table = my_table();
const uint64_t keys = hkeys(table);
for (int i = 0; i < hcount(table); ++i) {
    uint64_t key = keys[i];
    CF_V2 item = table[i]; // Could also do `hitems(table)` here.
    // ...
}

Remarks

This macro doesn't do much as h is already a valid pointer to the items.

htbl
hset
hadd
hget
hfind
hget_ptr
hfind_ptr
hhas
hdel
hclear
hkeys
hfree
hswap
hsize
hcount