C语言哈希表 uthash

openkk 12年前
     <p>uthash 是一个C语言的哈希表,支持各种结构类型的存储、添加、删除,这些操作都在固定的时间完成,跟哈希表本身的大小无关。键也可以是任何类型的数据。</p>    <p>示例代码:</p>    <pre class="brush:cpp; toolbar: true; auto-links: false;">#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 );     }</pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1325143958405" target="_blank">http://www.open-open.com/lib/view/home/1325143958405</a></p>    <p></p>