Add hashmap_iter example

pull/25/head v0.6.0
tidwall 3 years ago
parent c151e16526
commit 5a1f68a1aa

@ -71,6 +71,7 @@ int main() {
printf("\n-- iterate over all users (hashmap_scan) --\n"); printf("\n-- iterate over all users (hashmap_scan) --\n");
hashmap_scan(map, user_iter, NULL); hashmap_scan(map, user_iter, NULL);
printf("\n-- iterate over all users (hashmap_iter) --\n");
size_t iter = 0; size_t iter = 0;
void *item; void *item;
while (hashmap_iter(map, &iter, &item)) { while (hashmap_iter(map, &iter, &item)) {
@ -92,6 +93,12 @@ int main() {
// Dale (age=44) // Dale (age=44)
// Roger (age=68) // Roger (age=68)
// Jane (age=47) // Jane (age=47)
//
// -- iterate over all users (hashmap_iter) --
// Dale (age=44)
// Roger (age=68)
// Jane (age=47)
``` ```
## Functions ## Functions

Loading…
Cancel
Save