Defined in header
<variant> | ||
---|---|---|
template <class... Types> struct hash<std::variant<Types...>>; | (since C++17) |
The template specialization of std::hash
for the std::variant
template allows users to obtain hashes of variant
objects.
Types | - | the types of the alternatives supported by the variant object |
Type requirements | ||
-The specializations std::hash<T_i> must satisfy Hash for all T_i in Types... . |
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.
(C++11)
| hash function object (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/variant/hash