Skip to content

cf_map_has

Category: map
GitHub: cute_map.h


Check if a key exists in the map.

#define cf_map_has(m, k) map_has(m, k)
Parameters Description
m The map. Can be NULL. Must be declared with CF_MAP(T).
k The key for lookups. Keys are always typecast to uint64_t.

Return Value

Returns true if the key was found, false otherwise.

Code Example

Check if an item exists in the map.

CF_MAP(CF_V2) table = NULL;
map_set(table, 10, cf_v2(-1, 1));
CF_ASSERT(map_has(table, 10));
CF_ASSERT(!map_has(table, 99));
map_free(table);

CF_MAP
cf_map_set
cf_map_get
cf_map_get_ptr
cf_map_del
cf_map_clear
cf_map_keys
cf_map_items
cf_map_swap
cf_map_size
cf_map_free