You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
I tried using robin_hood::unordered_map, and its really nice! However, I tried using the is_transparent interface, and it almost works, but does not quite work: It looks like this is because you are putting std::hash into a wrapper.
I defined std::hash to accept a type BUILD_args_ref in addition to the keytype BUILD_args. This all works OK, except that robin_hood::hash doesn't accept my extra hashkey type! You can see this here:
// A thin wrapper around std::hash, performing an additional simple mixing step of the result.
template <typename T>
struct hash : public std::hash<T> {
size_t operator()(T const& obj) const
noexcept(noexcept(std::declval<std::hash<T>>().operator()(std::declval<T const&>()))) {
// call base hash
auto result = std::hash<T>::operator()(obj);
// return mixed of that, to be save against identity has
return hash_int(static_cast<uint64_t>(result));
}
template <typename K>
size_t operator()(K const& obj) const
noexcept(noexcept(std::declval<std::hash<T>>().operator()(std::declval<K const&>()))) {
// call base hash
auto result = std::hash<T>::operator()(obj);
// return mixed of that, to be save against identity has
return hash_int(static_cast<uint64_t>(result));
}
};
I am not sure if this is sufficiently careful, but it seems to work.
The text was updated successfully, but these errors were encountered:
Hi,
I tried using robin_hood::unordered_map, and its really nice! However, I tried using the
is_transparent
interface, and it almost works, but does not quite work: It looks like this is because you are putting std::hash into a wrapper.I defined std::hash to accept a type BUILD_args_ref in addition to the keytype BUILD_args. This all works OK, except that robin_hood::hash doesn't accept my extra hashkey type! You can see this here:
I made a quick hack that fixed this:
I am not sure if this is sufficiently careful, but it seems to work.
The text was updated successfully, but these errors were encountered: