std::hash<std::variant> (3) - Linux Manuals
std::hash<std::variant>: std::hash<std::variant>
Command to display std::hash<std::variant>
manual in Linux: $ man 3 std::hash<std::variant>
NAME
std::hash<std::variant> - std::hash<std::variant>
Synopsis
Defined in header <variant>
template <class... Types> (since C++17)
struct hash<std::variant<Types...>>;
The template specialization of std::hash for the std::variant template allows users to obtain hashes of variant objects.
The specialization std::hash<std::variant<Types...>> is enabled (see std::hash) if every specialization in std::hash<std::remove_const_t<Types>>... is enabled, and is disabled otherwise.
The member functions of this specialization are not guaranteed to be noexcept.
Template parameters
Types - the types of the alternatives supported by the variant object
Notes
Unlike std::hash<std::optional>, hash of a variant does not typically equal the hash of the contained value; this makes it possible to distinguish std::variant<int, int> holding the same value as different alternatives.
Example
This section is incomplete
Reason: no example
See also
hash hash function object
(class template)
(C++11)
Pages related to std::hash<std::variant>
- std::hash<std::error_code> (3) - std::hash<std::error_code>
- std::hash<std::error_condition> (3) - std::hash<std::error_condition>
- std::hash<std::experimental::optional> (3) - std::hash<std::experimental::optional>
- std::hash<std::optional> (3) - std::hash<std::optional>
- std::hash<std::thread::id> (3) - std::hash<std::thread::id>
- std::hash<std::type_index> (3) - std::hash<std::type_index>
- std::hash<std::unique_ptr> (3) - std::hash<std::unique_ptr>
- std::hash(std::bitset) (3) - std::hash(std::bitset)
- std::hash(std::experimental::observer_ptr) (3) - std::hash(std::experimental::observer_ptr)
- std::hash(std::experimental::propagate_const) (3) - std::hash(std::experimental::propagate_const)
- std::hash(std::experimental::shared_ptr) (3) - std::hash(std::experimental::shared_ptr)
- std::hash(std::experimental::string_view,std::experimental::wstring_view, (3) - std::hash(std::experimental::string_view,std::experimental::wstring_view,
- std::hash(std::experimental::string_view,std::experimental::wstring_view,std::experimental::u16string_view,std::experimental::u32string_view) (3) - std::hash(std::experimental::string_view,std::experimental::wstring_view,std::experimental::u16string_view,std::experimental::u32string_view)