Closed xissburg closed 3 years ago
That's because there is no hash for robin_hood::pair
. E.g. this might work (untested):
namespace robin_hood {
template<>
struct hash<robin_hood::pair<int, int>> {
size_t operator()(robin_hood::pair<int, int> const& p) const noexcept {
auto a = hash<int>{}(p.first);
auto b = hash<int>{}(p.second);
return hash_combine(a, b);
}
static size_t hash_combine(size_t seed, size_t v) noexcept {
// see https://www.boost.org/doc/libs/1_55_0/doc/html/hash/reference.html#boost.hash_combine
seed ^= v + 0x9e3779b9 + (seed << 6) + (seed >> 2);
return seed;
}
};
}
I am unable to create a
robin_hood::unordered_flat_map<robin_hood::pair<int, int>, int>
orrobin_hood::unordered_flat_map<std::pair<int, int>, int>
. This is the error I get:More details at https://godbolt.org/z/8WGoKz. Another observation was that I had to add
#include <limits>
in order to compile.