Implement new hashing protocol now that Boost.ContainerHash requires C++11:

- Hashes trivially scalar types
- For the non scalar types calls unqualified hash_value activating ADL (boost::hash protocol)
- If ADL does not find a viable candidate, a boost::hash direct call is performed via a forward declaration, so that additional candidates are looked up if the user has included boost/container_hash/hash.hpp.

This maintains a high level of compatibility with boost::hash but making Boost.Intrusive independent from Boost.ContainerHash, so that different C++ standard levels can be used and users using different hash functions don't need direct and indirect dependencies brought by Boost.ContainerHash.
This commit is contained in:
Ion Gaztañaga committed 2024-01-01 00:02:45 +01:00
1 parent 8b4297b1db
commit 6464d0e083
9 files changed
+820 -52

No files matched your search

+5 -1
View File
@@ -1304,7 +1304,11 @@ And they also can receive additional options:
in containers. Default: `equal< std::equal_to<T> >`
* [*`hash<class Hash>`]: Hash function to be used in the container.
Default: `hash< boost::hash<T> >`
Default: internal hash functor that hashes scalar types, triggering unqualified call to
`hash_value`for non-scalar types (boost::hash<T> compatible protocol). If
the ADL call does not find a viable candidate a boost::hash<T>() call is tried
in case the user has included boost/container_hash/hash.hpp and a viable
candidate is found there. Fails otherwise.
* [*`bucket_traits<class BucketTraits>`]: A type that wraps the bucket vector to
be used by the unordered container. Default: a type initialized by the address