updated is_avalanching trait protocol

This commit is contained in:
joaquintides
2024-05-29 19:51:32 +02:00
parent 6745d67d62
commit f77bdb9b67
8 changed files with 74 additions and 18 deletions
@@ -1,4 +1,5 @@
// Copyright 2022 Peter Dimov
// Copyright 2024 Joaquin M Lopez Munoz
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
@@ -26,6 +27,7 @@ namespace unordered
#include <boost/unordered/hash_traits.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <type_traits>
struct X1
{
@@ -36,6 +38,27 @@ struct X2
typedef void is_avalanching;
};
struct X4
{
using is_avalanching = std::false_type;
};
struct X5
{
using is_avalanching = std::true_type;
};
struct X6
{
using is_avalanching = boost::false_type;
};
struct X7
{
using is_avalanching = boost::true_type;
};
int main()
{
using boost::unordered::hash_is_avalanching;
@@ -43,6 +66,10 @@ int main()
BOOST_TEST_TRAIT_FALSE((hash_is_avalanching<X1>));
BOOST_TEST_TRAIT_TRUE((hash_is_avalanching<X2>));
BOOST_TEST_TRAIT_TRUE((hash_is_avalanching<X3>));
BOOST_TEST_TRAIT_FALSE((hash_is_avalanching<X4>));
BOOST_TEST_TRAIT_TRUE((hash_is_avalanching<X5>));
BOOST_TEST_TRAIT_FALSE((hash_is_avalanching<X6>));
BOOST_TEST_TRAIT_TRUE((hash_is_avalanching<X7>));
return boost::report_errors();
}