Unordered Associative Container

Overview
With the new C++11 standard, C++ has four unordered associative containers: std::unordered_map
, std::unordered_multimap
, std::unordered_set
and std::unordered_multiset
. They have a lot in common with their namesakes, the ordered associative containers. The difference is that the unordered ones have a richer interface and their keys are not sorted.
This shows the declaration of a std::unordered_map
.
template
<
class
key
,
class
val
,
class
Hash
=
std
::
hash
<
key
>
,
class
KeyEqual
=
std
::
equal_to
<
key
>
,
class
Alloc
=
std
::
allocator
<
std
::
pair
<
const
key
,
val
>>>
class
unordered_map
;
Like std::map
, std::unordered_map
has an allocator, but std::unordered_map
needs no comparison function. Instead std::unordered_map
needs two additional functions: One, to determine the hash value of its key: std::has<key>
and second, to compare the keys for equality: std::equal_to<key>
. Because of...