Skip to content

Commit 59e2a56

Browse files
authored
deprecated boost::unordered::hash_is_avalanching in favor of boost::hash_is_avalanching (#313)
* deprecated boost::unordered::hash_is_avalanching in favor of boost::hash_is_avalanching * replaced deprecation message with simpler BOOST_HEADER_DEPRECATED
1 parent 164cbe4 commit 59e2a56

16 files changed

+36
-93
lines changed

doc/modules/ROOT/pages/changes.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
== Release 1.89.0
1010

11+
* Deprecated `boost::unordered::hash_is_avalanching` is now a using-declaration of
12+
`boost::hash_is_avalanching` in `<boost/container_hash/hash_is_avalanching.hpp>`.
13+
Use that header directly instead. `<boost/unordered/hash_traits.hpp>` will be
14+
removed in the future.
1115
* Added `pull(const_iterator)` to open-addressing containers. This operation
1216
allows for efficient removal and retrieval of an element via move construction.
1317

doc/modules/ROOT/pages/hash_quality.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ struct my_string_hash_function
4343
----
4444

4545
By setting the
46-
`xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[hash_is_avalanching]` trait, we inform Boost.Unordered
46+
`link:../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[hash_is_avalanching]`
47+
trait, we inform Boost.Unordered
4748
that `my_string_hash_function` is of sufficient quality to be used directly without
4849
any post-mixing safety net. This comes at the risk of degraded performance in the
4950
cases where the hash function is not as well-behaved as we've declared.

doc/modules/ROOT/pages/rationale.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ and *high* and *low* are the upper and lower halves of an extended word, respect
102102
In 64-bit architectures, _C_ is the integer part of 2^64^&#8725;https://en.wikipedia.org/wiki/Golden_ratio[_&phi;_],
103103
whereas in 32 bits _C_ = 0xE817FB2Du has been obtained from https://arxiv.org/abs/2001.05304[Steele and Vigna (2021)^].
104104

105-
When using a hash function directly suitable for open addressing, post-mixing can be opted out of via a dedicated `xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[hash_is_avalanching]` trait.
105+
When using a hash function directly suitable for open addressing, post-mixing can be opted out of via a dedicated
106+
`link:../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[hash_is_avalanching]` trait.
106107
`boost::hash` specializations for string types are marked as avalanching.
107108

108109
=== Platform Interoperability

doc/modules/ROOT/pages/reference/concurrent_flat_map.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ The size of the bucket array can be automatically increased by a call to `insert
364364
greater than `max_load_factor()`, except possibly for small sizes where the implementation may decide to
365365
allow for higher loads.
366366

367-
If `xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[hash_is_avalanching]<Hash>::value` is `true`, the hash function
367+
If `link:../../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[hash_is_avalanching]<Hash>::value` is `true`, the hash function
368368
is used as-is; otherwise, a bit-mixing post-processing stage is added to increase the quality of hashing
369369
at the expense of extra computational cost.
370370

doc/modules/ROOT/pages/reference/concurrent_flat_set.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ The size of the bucket array can be automatically increased by a call to `insert
311311
greater than `max_load_factor()`, except possibly for small sizes where the implementation may decide to
312312
allow for higher loads.
313313

314-
If `xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[hash_is_avalanching]<Hash>::value` is `true`, the hash function
314+
If `link:../../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[hash_is_avalanching]<Hash>::value` is `true`, the hash function
315315
is used as-is; otherwise, a bit-mixing post-processing stage is added to increase the quality of hashing
316316
at the expense of extra computational cost.
317317

doc/modules/ROOT/pages/reference/concurrent_node_map.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ The size of the bucket array can be automatically increased by a call to `insert
381381
greater than `max_load_factor()`, except possibly for small sizes where the implementation may decide to
382382
allow for higher loads.
383383

384-
If `xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[hash_is_avalanching]<Hash>::value` is `true`, the hash function
384+
If `link:../../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[hash_is_avalanching]<Hash>::value` is `true`, the hash function
385385
is used as-is; otherwise, a bit-mixing post-processing stage is added to increase the quality of hashing
386386
at the expense of extra computational cost.
387387

doc/modules/ROOT/pages/reference/concurrent_node_set.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ The size of the bucket array can be automatically increased by a call to `insert
328328
greater than `max_load_factor()`, except possibly for small sizes where the implementation may decide to
329329
allow for higher loads.
330330

331-
If `xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[hash_is_avalanching]<Hash>::value` is `true`, the hash function
331+
If `link:../../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[hash_is_avalanching]<Hash>::value` is `true`, the hash function
332332
is used as-is; otherwise, a bit-mixing post-processing stage is added to increase the quality of hashing
333333
at the expense of extra computational cost.
334334

doc/modules/ROOT/pages/reference/hash_traits.adoc

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,22 @@
77

88
[listing,subs="+macros,+quotes"]
99
-----
10+
#include <boost/container_hash/hash_is_avalanching.hpp>
11+
1012
namespace boost {
1113
namespace unordered {
1214
13-
template<typename Hash>
14-
struct xref:#hash_traits_hash_is_avalanching[hash_is_avalanching];
15+
using boost::hash_is_avalanching;
1516
1617
} // namespace unordered
1718
} // namespace boost
1819
-----
1920

20-
---
21-
22-
=== hash_is_avalanching
23-
```c++
24-
template<typename Hash>
25-
struct hash_is_avalanching;
26-
```
27-
28-
A hash function is said to have the _avalanching property_ if small changes in the input translate to
29-
large changes in the returned hash code &#8212;ideally, flipping one bit in the representation of
30-
the input value results in each bit of the hash code flipping with probability 50%. Approaching
31-
this property is critical for the proper behavior of open-addressing hash containers.
32-
33-
`hash_is_avalanching<Hash>::value` is:
34-
35-
* `false` if `Hash::is_avalanching` is not present,
36-
* `Hash::is_avalanching::value` if this is present and convertible at compile time to a `bool`,
37-
* `true` if `Hash::is_avalanching` is `void` (this usage is deprecated),
38-
* ill-formed otherwise.
39-
40-
Users can then declare a hash function `Hash` as avalanching either by embedding an appropriate `is_avalanching` typedef
41-
into the definition of `Hash`, or directly by specializing `hash_is_avalanching<Hash>` to a class with
42-
an embedded compile-time constant `value` set to `true`.
21+
[horizontal]
22+
Note:;; This header is deprecated. Use instead
23+
`link:../../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[boost::hash_is_avalanching]`
24+
defined in
25+
`link:../../../../../container_hash/doc/html/hash.html#ref_boostcontainer_hashhash_is_avalanching_hpp[<boost/container_hash/hash_is_avalanching.hpp>]`.
4326

4427
Open-addressing and concurrent containers
4528
use the provided hash function `Hash` as-is if `hash_is_avalanching<Hash>::value` is `true`; otherwise, they

doc/modules/ROOT/pages/reference/stats.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ If the supplied hash function has good quality, then:
6666
* For unsuccessful lookups, the average number of element comparisons should be close to 0.0.
6767

6868
These statistics can be used to determine if a given hash function
69-
can be marked as xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[__avalanching__].
69+
can be marked as
70+
link:../../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[__avalanching__].
7071

7172
---

doc/modules/ROOT/pages/reference/unordered_flat_map.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ The size of the bucket array can be automatically increased by a call to `insert
317317
greater than `max_load_factor()`, except possibly for small sizes where the implementation may decide to
318318
allow for higher loads.
319319

320-
If `xref:reference/hash_traits.adoc#hash_traits_hash_is_avalanching[hash_is_avalanching]<Hash>::value` is `true`, the hash function
320+
If `link:../../../../../container_hash/doc/html/hash.html#ref_hash_is_avalanchinghash[hash_is_avalanching]<Hash>::value` is `true`, the hash function
321321
is used as-is; otherwise, a bit-mixing post-processing stage is added to increase the quality of hashing
322322
at the expense of extra computational cost.
323323

0 commit comments

Comments
 (0)