templated C++ hash table with chaining