cpp/utility/hash

Each specialization of this template is either enabled ("untainted") or disabled ("poisoned").

The enabled specializations of the template defines a function object that implements a. Instances of this function object satisfy. In particular, they define an that:


 * 1) Accepts a single parameter of type.
 * 2) Returns a value of type  that represents the hash value of the parameter.
 * 3) Does not throw exceptions when called.
 * 4) For two parameters  and  that are equal,.
 * 5) For two different parameters  and  that are not equal, the probability that  should be very small, approaching.

All explicit and partial specializations of provided by the standard library are, ,  and. User-provided specializations of also must meet those requirements.

The unordered associative containers std, std, std, std use specializations of the template std as the default hash function.

For every type for which neither the library nor the user provides an enabled specialization, that specialization exists and is disabled. Disabled specializations do not satisfy, do not satisfy , and following values are all :

In other words, they exist, but cannot be used.

Member types
}}

Standard specializations for basic types
In addition to the above, the standard library provides specializations for all (scoped and unscoped) enumeration types. These may be (but are not required to be) implemented as.

The standard library provides enabled specializations of for std and all cv-unqualified arithmetic types (including any extended integer types), all enumeration types, and all pointer types.

Each standard library header that declares the template provides all enabled specializations described above. These headers include, , , , , ,.

Standard specializations for library types
Note: additional specializations for std and the standard container types, as well as utility functions to compose hashes are available in.