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
This commit is contained in:
joaquintides
2025-06-02 12:43:45 +02:00
committed by GitHub
parent 164cbe4e0f
commit 59e2a562ed
16 changed files with 36 additions and 93 deletions

View File

@@ -1,6 +1,6 @@
/* Common base for Boost.Unordered open-addressing tables.
*
* Copyright 2022-2024 Joaquin M Lopez Munoz.
* Copyright 2022-2025 Joaquin M Lopez Munoz.
* Copyright 2023 Christian Mazakas.
* Copyright 2024 Braden Ganetsky.
* Distributed under the Boost Software License, Version 1.0.
@@ -16,6 +16,7 @@
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <boost/container_hash/hash_is_avalanching.hpp>
#include <boost/core/allocator_traits.hpp>
#include <boost/core/bit.hpp>
#include <boost/core/empty_value.hpp>
@@ -28,7 +29,6 @@
#include <boost/unordered/detail/mulx.hpp>
#include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/unordered/hash_traits.hpp>
#include <boost/unordered/unordered_printers.hpp>
#include <climits>
#include <cmath>
@@ -1426,7 +1426,7 @@ public:
using size_policy=pow2_size_policy;
using prober=pow2_quadratic_prober;
using mix_policy=typename std::conditional<
hash_is_avalanching<Hash>::value,
boost::hash_is_avalanching<Hash>::value,
no_mix,
mulx_mix
>::type;

View File

@@ -1,6 +1,6 @@
/* Hash function characterization.
*
* Copyright 2022-2024 Joaquin M Lopez Munoz.
* Copyright 2022-2025 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -11,58 +11,15 @@
#ifndef BOOST_UNORDERED_HASH_TRAITS_HPP
#define BOOST_UNORDERED_HASH_TRAITS_HPP
#include <boost/unordered/detail/type_traits.hpp>
#include <boost/config/header_deprecated.hpp>
#include <boost/container_hash/hash_is_avalanching.hpp>
BOOST_HEADER_DEPRECATED("<boost/container_hash/hash_is_avalanching.hpp>")
namespace boost{
namespace unordered{
namespace detail{
template<typename Hash,typename=void>
struct hash_is_avalanching_impl:std::false_type{};
template<typename IsAvalanching>
struct avalanching_value
{
static constexpr bool value=IsAvalanching::value;
};
/* may be explicitly marked as BOOST_DEPRECATED in the future */
template<> struct avalanching_value<void>
{
static constexpr bool value=true;
};
template<typename Hash>
struct hash_is_avalanching_impl<
Hash,
boost::unordered::detail::void_t<typename Hash::is_avalanching>
>:std::integral_constant<
bool,
avalanching_value<typename Hash::is_avalanching>::value
>{};
template<typename Hash>
struct hash_is_avalanching_impl<
Hash,
typename std::enable_if<((void)Hash::is_avalanching,true)>::type
>{}; /* Hash::is_avalanching is not a type: compile error downstream */
} /* namespace detail */
/* Each trait can be partially specialized by users for concrete hash functions
* when actual characterization differs from default.
*/
/* hash_is_avalanching<Hash>::value is:
* - false if Hash::is_avalanching is not present.
* - Hash::is_avalanching::value if this is present and constexpr-convertible
* to a bool.
* - true if Hash::is_avalanching is void (deprecated).
* - ill-formed otherwise.
*/
template<typename Hash>
struct hash_is_avalanching: detail::hash_is_avalanching_impl<Hash>::type{};
using boost::hash_is_avalanching;
} /* namespace unordered */
} /* namespace boost */