30 #ifndef BASE_STL_HELPERS_HASH_HELPERS_HH
31 #define BASE_STL_HELPERS_HASH_HELPERS_HH
36 #include <type_traits>
37 #include <unordered_map>
38 #include <unordered_set>
45 #include <type_traits>
62 static constexpr uint64_t
C = 0xbea225f9eb34556d;
63 template<
typename... T>
66 [[maybe_unused]]
auto combine = [](uint64_t
a, uint64_t
b) {
79 ((acc = combine(acc,
static_cast<uint64_t
>(hashes))), ...);
80 return static_cast<size_t>(acc);
91 return static_cast<size_t>(
x);
95 template<
typename T,
typename =
void>
100 struct hash<T,
std::enable_if_t<is_std_hash_enabled_v<T>>>: std::hash<T>
116 template<
typename... T>
120 if constexpr (
sizeof...(T) == 0) {
123 return std::apply([](
const auto&...
e){
131 template<
typename T,
typename U>
142 !is_std_hash_enabled_v<T> && is_iterable_v<T>>>
147 if (
b ==
e)
return 0;
151 [](
const auto& acc,
const auto&
val) {
158 template<
typename,
typename =
void>
161 template <
typename T>
163 std::void_t<decltype(hash<T>()(std::declval<T>()))>> =
true;
186 typename KeyEqual = std::equal_to<Key>,
187 typename Allocator = std::allocator< std::pair<const Key, T> >>
194 typename KeyEqual = std::equal_to<Key>,
195 typename Allocator = std::allocator<Key>>
201 #endif // BASE_STL_HELPERS_HASH_HELPERS_HH