9#ifdef IDOL_USE_ROBINHOOD
10#include <robin_hood.h>
13#include <unordered_map>
22#ifdef IDOL_USE_ROBINHOOD
23 template<
class T,
class EnableT =
void>
using hash = robin_hood::hash<T, EnableT>;
25 template<
class A>
using hash = std::hash<A>;
29 inline void hash_combine(std::size_t &seed,
const T &val) {
30 seed ^= hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
34 template <
typename T>
inline void hash_val(std::size_t &seed,
const T &val) {
35 hash_combine(seed, val);
38 template <
typename T,
typename... Types>
39 inline void hash_val(std::size_t &seed,
const T &val,
const Types &... args) {
40 hash_combine(seed, val);
41 hash_val(seed, args...);
44 template <
typename... Types>
45 inline std::size_t hash_val(
const Types &... args) {
47 hash_val(seed, args...);
53template<
class Key1,
class Key2>
54struct std::hash<idol::Pair<Key1, Key2>> {
56 return idol::impl::hash_val(t_pair.first, t_pair.second);
60template<
class Key1,
class Key2>
61struct std::hash<idol::CommutativePair<Key1, Key2>> {
63 return idol::impl::hash_val(t_pair.first, t_pair.second);
67#ifdef IDOL_USE_ROBINHOOD
74 class Hash = impl::hash<Key>,
75 class KeyEqual = std::equal_to<Key>
77 using Map = robin_hood::unordered_map<Key, T, Hash, KeyEqual>;
88 class Hash = impl::hash<KeyT>,
89 class KeyEqual = std::equal_to<KeyT>,
90 class Allocator = std::allocator<std::pair<const KeyT, T> >
92 using Map = std::unordered_map<KeyT, T, Hash, KeyEqual, Allocator>;