std::hash<std::type_index>

Defined in header <typeindex> template<> struct hash<type_index>; (since C++11) The template specialization of std::hash for std::type_index allows users to obtain hashes of objects of type std::type_index. The member operator() effectively returns the same value as hash_code(). See also hash_code returns hashed code (public member function)

std::hash&lt;std::thread::id&gt;

Defined in header <thread> template<> struct hash<std::thread::id>; (since C++11) The template specialization of std::hash for the std::thread::id class allows users to obtain hashes of the identifiers of threads. Example #include <iostream> #include <thread> #include <chrono> #include <vector> using namespace std::literals::chrono_literals; void foo() { std::this_thread::sleep_for(10ms); } int main() { std::vector<std::

std::hash&lt;std::error_code&gt;

Defined in header <system_error> template<> struct hash<error_code>; (since C++11) The template specialization of std::hash for std::error_code allows users to obtain hashes of objects of type std::error_code.

std::hash::hash

The std::hash class should be DefaultConstructible, CopyConstructible, and Destructible.

std::hash

Defined in header <string> template<> struct hash<std::string>; template<> struct hash<std::wstring>; template<> struct hash<std::u16string>; template<> struct hash<std::u32string>; (since C++11) The template specializations of std::hash for the various string classes allow users to obtain hashes of strings. Example The following code shows one possible output of a hash function used on a string: #include <iostream>

std::hash

template <class Allocator> struct hash<vector<bool, Allocator>>; (since C++11) The template specialization of std::hash for std::vector<bool> allows users to obtain hashes of objects of type std::vector<bool>. Example See also hash (C++11) hash function object (class template)

std::hash

template<class T, class Deleter> struct hash<unique_ptr<T, Deleter>>; (since C++11) The template specialization of std::hash for std::unique_ptr<T, Deleter> allows users to obtain hashes of objects of type std::unique_ptr<T, Deleter>. For a given std::unique_ptr<T, Deleter> p, this specialization ensures that std::hash<std::unique_ptr<T, Deleter>>()(p) == std::hash<T*>()(p.get()). Example #include <iostream> #include <m

std::hash

template<class T> struct hash<shared_ptr<T>>; (since C++11) The template specialization of std::hash for std::shared_ptr<T> allows users to obtain hashes of objects of type std::shared_ptr<T>. For a given std::shared_ptr<T> p, this specialization ensures that std::hash<std::shared_ptr<T>>()(p) == std::hash<T*>()(p.get()). Example See also hash (C++11) hash function object (class template)

std::hash

template<size_t N> struct hash<bitset<N>>; (since C++11) The template specialization of std::hash for std::bitset<N> allows users to obtain hashes of objects of type std::bitset<N>. Example The following code shows one possible output of a hash function used on several bitsets: #include <iostream> #include <bitset> #include <functional> int main() { std::bitset<4> b1(1); std::bitset<4> b2(2); std::bitset<4&

std::hash

Defined in header <functional> template< class Key > struct hash; (since C++11) The hash template defines a function object that implements a hash function. Instances of this function object satisfy Hash. In particular, they define an operator() that: 1. Accepts a single parameter of type Key. 2. Returns a value of type size_t that represents the hash value of the parameter. 3. Does not throw exceptions when called. 4. For two parameters k1 and k2 that are equal, std: