From 00dba6082e245d917cb7d6eed3c627211ff41cd7 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期五, 25 九月 2020 15:53:21 +0800 Subject: [PATCH] update --- 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