A generic hash table
A generic hash table
Posted Aug 13, 2012 23:42 UTC (Mon) by liljencrantz (guest, #28458)In reply to: A generic hash table by Cyberax
Parent article: A generic hash table
Do you want an open addressing implementation? What type of probing? A Cuckoo hash? Do you use a linked list to allow ordered iteration? Do you allow hash table modification during iteration? If so, only using that iterator or arbitrary insertions? What resize strategy do you use when growing the table? What resize strategy do you use when shrinking the table? Do you store precalculated hash codes in the table? Do you use tombstones to mark deleted entries?
No matter what you answer to the above questions, you will make your hash table nearly useless for a large swath of people. And you can try to make the answer to all those questions decidable at compile time through templates, but that solution comes with it's own set of painful drawbacks.
You might also notice, that generic tree based red black trees have been present in the Linux kernel since forever.