Hashtable in C++?

If you’re using C++11, you have access to the <unordered_map> and <unordered_set> headers. These provide classes std::unordered_map and std::unordered_set.

If you’re using C++03 with TR1, you have access to the classes std::tr1::unordered_map and std::tr1::unordered_set, using the same headers (unless you’re using GCC, in which case the headers are <tr1/unordered_map> and <tr1/unordered_set> instead).

In all cases, there are corresponding unordered_multimap and unordered_multiset types too.

Leave a Comment