forked from boostorg/unordered
updated is_avalanching trait protocol
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
* Added container `pmr` aliases when header `<memory_resource>` is available. The alias `boost::unordered::pmr::[container]` refers to `boost::unordered::[container]` with a `std::pmr::polymorphic_allocator` allocator type.
|
||||
* Equipped open-addressing and concurrent containers to internally calculate and provide statistical metrics affected by the quality of the hash function. This functionality is enabled by the global macro `BOOST_UNORDERED_ENABLE_STATS`.
|
||||
* Avalanching hash functions must now be marked via an `is_avalanching` typedef with an embedded `value` constant set to `true` (typically, defining `is_avalanching` as `std::true_type`). `using is_avalanching = void` is deprecated but allowed for backwards compatibility.
|
||||
|
||||
== Release 1.85.0
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ follows:
|
||||
----
|
||||
struct my_string_hash_function
|
||||
{
|
||||
using is_avalanching = void; // instruct Boost.Unordered to not use post-mixing
|
||||
using is_avalanching = std::true_type; // instruct Boost.Unordered to not use post-mixing
|
||||
|
||||
std::size_t operator()(const std::string& x) const
|
||||
{
|
||||
|
||||
@@ -32,9 +32,14 @@ large changes in the returned hash code —ideally, flipping one bit in the
|
||||
the input value results in each bit of the hash code flipping with probability 50%. Approaching
|
||||
this property is critical for the proper behavior of open-addressing hash containers.
|
||||
|
||||
`hash_is_avalanching<Hash>::value` is `true` if `Hash::is_avalanching` is a valid type,
|
||||
and `false` otherwise.
|
||||
Users can then declare a hash function `Hash` as avalanching either by embedding an `is_avalanching` typedef
|
||||
`hash_is_avalanching<Hash>::value` is:
|
||||
|
||||
* `false` if `Hash::is_avalanching` is not present,
|
||||
* `Hash::is_avalanching::value` if this is present and convertible at compile time to a `bool`,
|
||||
* `true` if `Hash::is_avalanching` is `void` (this usage is deprecated).
|
||||
|
||||
The behavior is undefined if none of the three cases above is met.
|
||||
Users can then declare a hash function `Hash` as avalanching either by embedding an appropriate `is_avalanching` typedef
|
||||
into the definition of `Hash`, or directly by specializing `hash_is_avalanching<Hash>` to a class with
|
||||
an embedded compile-time constant `value` set to `true`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user