3 ms·
> Why do you need to maintain a reference to a hash node? > Or do you mean maintaining a reference to the value stored? The hash node is the value stored; man
by JoshTriplett 12y ago
> Why do you need to maintain a reference to a hash node?
> Or do you mean maintaining a reference to the value stored?
The hash node is the value stored; many hash tables are maps from keys to objects, and the objects get linked directly into the hash chain without further indirection.
The Linux kernel hash tables have a structure hlist_node which contains a next and previous pointer, and objects linkable into a hash table will contain an hlist_node as a field. This avoids having an extra level of indirection to get from a hash node to the hashed object.