I was wondering if you knew of a robust implementation of a hashtable in C. I'm looking for something other than ghashtable in glib. Thanks.
我听说过关于GLib Hash Table 的好消息。
In C:
g_hash_table
in gLib: http://library.gnome.org/devel/glib/stable/glib-Hash-Tables.htmluthash
: https://github.com/troydhanson/uthash khash
in klib: https://github.com/attractivechaos/klib cdada_map
in libcdada: https://github.com/msune/libcdada (C API, backend C++) If you can/want to use C++:
std::map
in libstdc++ (look into std::unordered_map
too) sparsehash
: https://github.com/sparsehash/sparsehash (look into dense too)Will this hashtable work? (got the link from the second post of this thread )
Perhaps this one will?
(got the above from a Google search for "hashtable in c", am not a C programmer)
For a hash table I'd use google-sparsehash
PD: I don't know your requirements, but take a look at HDF5 , bear in mind it exists just in case.
update
Memory Structures Library (MemSL2), o MemSL2 in another link it has implementations (one in pure C and wrappers for C++) of structures, for example, AVL trees, threaded trees, ..., and
A simple one in libc, see <hsearch.h> and man hsearch
.
Update: just found that you can implement hashtable very easily with the help of hlist
from Linux kernel. Take a look at <list.h> in Linux kernel source code for hlist_head/node
and their operations.
You might want to look into using the Apache Portable Runtime? It's license is very liberal and it provides a decent hashtable implementation:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.