int main(void)
{
int absent;
khint_t k;
kh_t *h = kh_init();
// put
k = kh_put(h, 20, &absent);
k = kh_put(h, 50, &absent);
// iterate
kh_foreach(h, k)
printf("h[%d]\n", kh_key(h, k));
kh_destroy(h);
return 0;
}
* GCC output
a.c:19:22: error: member reference base type 'uint32_t' (aka 'unsigned int') is not a structure or union
printf("h[%lu]\n", kh_key(h, k));
^~~~
./khashl.h:388:35: note: expanded from macro 'kh_key'
Some issue with set:
// set error KHASHL_SET_INIT(KH_LOCAL, kh_t, kh, uint32_t, kh_hash_uint32, kh_eq_generic)
// map is okay // KHASHL_MAP_INIT(KH_LOCAL, kh_t, kh, uint32_t, int, kh_hash_uint32, kh_eq_generic)
int main(void) { int absent; khint_t k; kh_t *h = kh_init();
}
a.c:19:22: error: member reference base type 'uint32_t' (aka 'unsigned int') is not a structure or union printf("h[%lu]\n", kh_key(h, k)); ^
~~~ ./khashl.h:388:35: note: expanded from macro 'kh_key'define kh_key(h, x) ((h)->keys[x].key)
1 error generated. make: *** [: a] Error 1