For accessing data based on key lookup, the C++ standard library offers std::set,
std::map, std::multiset
and std::multimap. These are generally implemented
using balanced binary trees so that lookup time has logarithmic complexity.
That is generally okay, but in many cases a hash
table can perform better, as accessing data has constant complexity,
on average. The worst case complexity is linear, but that occurs rarely and
with some care, can be avoided.

Also, the existing containers require a 'less than' comparison object to order
their elements. For some data types this is impossible to implement or isn't
practical. In contrast, a hash table only needs an equality function and a
hash function for the key.

With this in mind, unordered associative containers were added to the C++ standard.
This is an implementation of the containers described in C++11, with some
deviations from the standard in
order to work with non-C++11 compilers and libraries.

To store an object in an unordered associative container requires both an key
equality function and a hash function. The default function objects in the
standard containers support a few basic types including integer types, floating
point types, pointer types, and the standard strings. Since Boost.Unordered
uses boost::hash it also supports
some other types, including standard containers. To use any types not supported
by these methods you have to extend Boost.Hash
to support the type or use your own custom equality predicates and hash
functions. See the Equality Predicates
and Hash Functions section for more details.