boostorg / unordered

Boost.org unordered module
http://boost.org/libs/unordered
Boost Software License 1.0
62 stars 55 forks source link

Change `is_avalanching` protocol to one based on `std::[true|false]_type` #248

Closed joaquintides closed 3 months ago

joaquintides commented 4 months ago

Currently, hash function avalanching is indicated by the mere presence of a nested is_avalanching typedef (like is_transparent). Change that to requiring that is_avalanching is std::[true|false]_type (or derived from those), in the same vein as propagate traits for allocators.

To keep backwards compatiblity, if is_avalanching is present but not (derived from) std::[true|false]_type , this must be taken as equivalent to using is_avalanching = std::true_type.

pdimov commented 4 months ago

I'm not sure that we need to support anything other than void for backward compatibility as that's what's presently used and documented everywhere. Silently accepting any type and treating it as true makes it way too easy to introduce errors.

pdimov commented 4 months ago

I think what we want is: hash_is_avalanching<H> is

in the case H::is_avalanching exists, of course.

This accepts boost::integral_constant<bool, B> and other non-std integral constants such as mpl::bool_.