From 3c4b18f39e06a09a05a13476f212d4deaa1e4707 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期日, 23 八月 2020 13:10:15 +0800 Subject: [PATCH] Merge branch 'master' of https://shmqueue --- src/queue/include/hashtable.h | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/queue/include/hashtable.h b/src/queue/include/hashtable.h index 726a5bc..30affe2 100755 --- a/src/queue/include/hashtable.h +++ b/src/queue/include/hashtable.h @@ -2,6 +2,7 @@ #define __HASHTABLE_H__ #include <sys/queue.h> +#include <functional> #include <set> #define MAPSIZE 100 @@ -23,10 +24,17 @@ void *hashtable_remove(hashtable_t *hashtable, int key); void hashtable_removeall(hashtable_t *hashtable); +/** + * 閬嶅巻hash_table + * @demo + * hashtable_foreach(&hashtable, [&](int key, void * value){ + * printf("%d, %p\n", key, value); + * }); + * +*/ +void hashtable_foreach(hashtable_t *hashtable, std::function<void(int, void *)> cb); -void hashtable_foreach(hashtable_t *hashtable, hashtable_foreach_cb cb); - -void hashtable_printall(hashtable_t *hashtable); +// void hashtable_printall(hashtable_t *hashtable); int hashtable_alloc_key(hashtable_t *hashtable); -- Gitblit v1.8.0