-
-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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 templateankerl::unordered_dense::hash
which falls back tostd::hash
doesn't currently propagate theis_avalanching
trait. So it won't be detected unless hashes are moved toankerl::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 arequire_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 withis_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, ...>;
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request