diff options
Diffstat (limited to 'src/common/hash.h')
| -rw-r--r-- | src/common/hash.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/hash.h b/src/common/hash.h index 40194d1ee..ebd4125e2 100644 --- a/src/common/hash.h +++ b/src/common/hash.h | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | #include <cstddef> | 7 | #include <cstddef> |
| 8 | #include <cstring> | 8 | #include <cstring> |
| 9 | #include <utility> | ||
| 10 | #include <boost/functional/hash.hpp> | ||
| 9 | #include "common/cityhash.h" | 11 | #include "common/cityhash.h" |
| 10 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 11 | 13 | ||
| @@ -68,4 +70,13 @@ struct HashableStruct { | |||
| 68 | } | 70 | } |
| 69 | }; | 71 | }; |
| 70 | 72 | ||
| 73 | struct PairHash { | ||
| 74 | template <class T1, class T2> | ||
| 75 | std::size_t operator()(const std::pair<T1, T2>& pair) const noexcept { | ||
| 76 | std::size_t seed = std::hash<T1>()(pair.first); | ||
| 77 | boost::hash_combine(seed, std::hash<T2>()(pair.second)); | ||
| 78 | return seed; | ||
| 79 | } | ||
| 80 | }; | ||
| 81 | |||
| 71 | } // namespace Common | 82 | } // namespace Common |