uthash- C语言哈希表
C/C++ 常用工具包
共0Star
详细介绍
uthash 是一个C语言的哈希表,支持各种结构类型的存储、添加、删除,这些操作都在固定的时间完成,跟哈希表本身的大小无关。键也可以是任何类型的数据。
示例代码:
#include "uthash.h"
struct my_struct {
int id; /* we'll use this field as the key */
char name[10];
UT_hash_handle hh; /* makes this structure hashable */
};
struct my_struct *users = NULL;
void add_user(struct my_struct *s) {
HASH_ADD_INT( users, id, s );
}
-
212 Star
-
0 Star
-
2523 Star
-
0 Star
-
0 Star
-
32 Star
-
0 Star
-
0 Star
-
0 Star
-
213 Star