53 inline void hash_combine(std::size_t& seed, T
const& v)
55 seed ^= std::hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
59 template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1>
62 static void apply(
size_t & seed, Tuple
const & tuple)
64 HashValueImpl<Tuple, Index-1>::apply(seed, tuple);
65 hash_combine(seed, std::get<Index>(tuple));
69 template <
class Tuple>
70 struct HashValueImpl<Tuple,0>
72 static void apply(
size_t & seed, Tuple
const & tuple)
74 hash_combine(seed, std::get<0>(tuple));
83 operator()(TT
const& tt)
const
85 return std::hash<TT>()(tt);
89template <
typename ... TT>
90struct hash<std::tuple<TT...>>
93 operator()(std::tuple<TT...>
const & tt)
const
96 HashValueImpl<std::tuple<TT...> >::apply(seed, tt);
101template <
typename T,
typename U>
105 operator()(std::pair<T, U>
const &value)
const
107 std::size_t seed = 0;
108 hash_combine(seed, value.first);
109 hash_combine(seed, value.second);