Add hash for std::pair

This commit is contained in:
Nikita Lisitsa 2022-02-08 20:34:53 +03:00
parent fa581d0ed3
commit ef80db2620

View file

@ -32,6 +32,19 @@ namespace psemek::util
namespace std
{
template <typename T, typename H>
struct hash<std::pair<T, H>>
: std::pair<std::hash<T>, std::hash<H>>
{
std::size_t operator()(std::pair<T, H> const & x) const
{
std::size_t seed = 0;
::psemek::util::hash_combine(seed, this->first(x.first));
::psemek::util::hash_combine(seed, this->second(x.second));
return seed;
}
};
template <typename ... Ts>
struct hash<std::tuple<Ts...>>
: std::tuple<std::hash<Ts>...>