30#ifndef BASE_STL_HELPERS_HASH_HELPERS_HH
31#define BASE_STL_HELPERS_HASH_HELPERS_HH
37#include <unordered_map>
38#include <unordered_set>
62static constexpr uint64_t
C = 0xbea225f9eb34556d;
63template<
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);
95template<
typename T,
typename =
void>
100struct hash<T,
std::enable_if_t<is_std_hash_enabled_v<T>>>: std::hash<T>
116template<
typename... T>
120 if constexpr (
sizeof...(T) == 0) {
123 return std::apply([](
const auto&...
e){
131template<
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) {
158template<
typename,
typename =
void>
159constexpr bool is_hash_enabled =
false;
162constexpr bool is_hash_enabled<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>>
constexpr auto hash_value(const T &v)
constexpr size_t hash_combine(T... hashes)
constexpr bool is_hash_enabled
constexpr size_t hash_refine(size_t x)
constexpr auto make_hash_for(const T &)
static constexpr uint64_t C
Overload hash function for BasicBlockRange type.
constexpr size_t operator()(const T &t) const
constexpr size_t operator()(const std::pair< T, U > &p) const
constexpr size_t operator()(const std::tuple< T... > &t) const