pair.h
Go to the documentation of this file.
1 #ifndef TTG_UTIL_HASH_STD_PAIR_H
2 #define TTG_UTIL_HASH_STD_PAIR_H
3 
4 #include "ttg/util/hash.h"
5 
6 #include <utility>
7 
8 namespace ttg::overload {
9 
10  template <typename T1, typename T2>
11  struct hash<std::pair<T1, T2>,
12  std::enable_if_t<meta::has_ttg_hash_specialization_v<T1> && meta::has_ttg_hash_specialization_v<T2>>> {
13  auto operator()(const std::pair<T1, T2>& t) const {
14  std::size_t seed = 0;
15  hash_combine(seed, t.first);
16  hash_combine(seed, t.second);
17  return seed;
18  }
19  };
20 
21 } // namespace ttg::overload
22 
23 #endif // TTG_UTIL_HASH_PAIR_H
place for overloading/instantiating hash and other functionality
Definition: pair.h:8
void hash_combine(std::size_t &seed, T const &v)
Definition: hash.h:147
Computes hash values for objects of type T.
Definition: hash.h:81