C ++ hash table implementation with conflict handling

What is a good C ++ library for hash tables / hash maps similar to what Java offers. I've worked with Google Sparsehash, but it doesn't support collisions.

+2


a source to share


3 answers


In addition to the ones mentioned in other answers, you can try MCT closed_hash_map

or linked_hash_map

. It is internally similar to Google SparseHash, but does not limit the values ​​used and has some other functional benefits.



I'm not sure I understand what you mean by "no collision support". Both Google SparseHash and similarly implemented MCTs, of course, handle conflicts perfectly, although they differ from Java HashMap

.

+1


a source


Use std :: unordered_map (or unordered_multimap), which despite its name is a hash table - it will be part of the next C ++ standard, and is available in most modern C ++ implementations. Do not use classes with hash

in your names that may be implemented in your implementation - they are not and will not be standard.



+6


a source


http://www.sgi.com/tech/stl/hash_multimap.html

or

std::tr1::unordered_multimap

+2


a source







All Articles