First of all, thanks for making this awesome library!
Is your feature request related to a problem? Please describe.
The mechanism for tagging high quality hashes could be improved a bit, so it's easier to integrate in existing code bases.
Describe the solution you'd like
- I prefer to specialize
std::hash, but the primary template ankerl::unordered_dense::hash which falls back to std::hash doesn't currently propagate the is_avalanching trait. So it won't be detected unless hashes are moved to ankerl::unordered_dense namespace.
- In my project, all hashes are supposed to be high quality, but it's easy to forget to add the
is_avalanching trait. It would be nice to have a require_avalanching policy on the container that can be asserted at compile time.
- An additional
assume_avalanching policy sounds a little dangerous, but would avoid having to litter code with is_avalanching traits.
Describe alternatives you've considered
My approach for (2) is to wrap the default hash type:
template <typename Hash>
struct require_avalanching : Hash
{
static_assert(requires { typename Hash::is_avalanching; });
};
// alias with default policy
template <class Key, class Hash = require_avalanching<ankerl::unordered_dense::hash<Key>>, ...>
using hash_set = ankerl::unordered_dense::set<Key, Hash, ...>;
First of all, thanks for making this awesome library!
Is your feature request related to a problem? Please describe.
The mechanism for tagging high quality hashes could be improved a bit, so it's easier to integrate in existing code bases.
Describe the solution you'd like
std::hash, but the primary templateankerl::unordered_dense::hashwhich falls back tostd::hashdoesn't currently propagate theis_avalanchingtrait. So it won't be detected unless hashes are moved toankerl::unordered_densenamespace.is_avalanchingtrait. It would be nice to have arequire_avalanchingpolicy on the container that can be asserted at compile time.assume_avalanchingpolicy sounds a little dangerous, but would avoid having to litter code withis_avalanchingtraits.Describe alternatives you've considered
My approach for (2) is to wrap the default hash type: