From fefb6ad4c43ba19aba2045c2820e751ecfaa818f Mon Sep 17 00:00:00 2001 From: LeonineKing1199 Date: Wed, 8 Dec 2021 13:59:11 -0800 Subject: [PATCH] Remove unnecessary expression test mechanisms --- .../boost/unordered/detail/implementation.hpp | 110 ------------------ 1 file changed, 110 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index a95dde23..97922941 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -844,116 +844,6 @@ namespace boost { } } -//////////////////////////////////////////////////////////////////////////// -// Expression test mechanism -// -// When SFINAE expressions are available, define -// BOOST_UNORDERED_HAS_FUNCTION which can check if a function call is -// supported by a class, otherwise define BOOST_UNORDERED_HAS_MEMBER which -// can detect if a class has the specified member, but not that it has the -// correct type, this is good enough for a passable impression of -// allocator_traits. - -#if !defined(BOOST_NO_SFINAE_EXPR) - -namespace boost { - namespace unordered { - namespace detail { - template struct expr_test; - template struct expr_test : T - { - }; - } - } -} - -#define BOOST_UNORDERED_CHECK_EXPRESSION(count, result, expression) \ - template \ - static \ - typename boost::unordered::detail::expr_test::type \ - test(BOOST_PP_CAT(choice, count)) - -#define BOOST_UNORDERED_DEFAULT_EXPRESSION(count, result) \ - template \ - static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count)) - -#define BOOST_UNORDERED_HAS_FUNCTION(name, thing, args, _) \ - struct BOOST_PP_CAT(has_, name) \ - { \ - template static char for_expr_test(U const&); \ - BOOST_UNORDERED_CHECK_EXPRESSION( \ - 1, 1, boost::unordered::detail::make().name args); \ - BOOST_UNORDERED_DEFAULT_EXPRESSION(2, 2); \ - \ - enum \ - { \ - value = sizeof(test(choose())) == sizeof(choice1::type) \ - }; \ - } - -#else - -namespace boost { - namespace unordered { - namespace detail { - template struct identity - { - typedef T type; - }; - } - } -} - -#define BOOST_UNORDERED_CHECK_MEMBER(count, result, name, member) \ - \ - typedef \ - typename boost::unordered::detail::identity::type BOOST_PP_CAT( \ - check, count); \ - \ - template struct BOOST_PP_CAT(test, count) \ - { \ - typedef BOOST_PP_CAT(choice, result) type; \ - }; \ - \ - template \ - static typename BOOST_PP_CAT(test, count)<&U::name>::type test( \ - BOOST_PP_CAT(choice, count)) - -#define BOOST_UNORDERED_DEFAULT_MEMBER(count, result) \ - template \ - static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count)) - -#define BOOST_UNORDERED_HAS_MEMBER(name) \ - struct BOOST_PP_CAT(has_, name) \ - { \ - struct impl \ - { \ - struct base_mixin \ - { \ - int name; \ - }; \ - struct base : public T, public base_mixin \ - { \ - }; \ - \ - BOOST_UNORDERED_CHECK_MEMBER(1, 1, name, int base_mixin::*); \ - BOOST_UNORDERED_DEFAULT_MEMBER(2, 2); \ - \ - enum \ - { \ - value = sizeof(choice2::type) == sizeof(test(choose())) \ - }; \ - }; \ - \ - enum \ - { \ - value = impl::value \ - }; \ - } - -#endif - //////////////////////////////////////////////////////////////////////////// // TRAITS TYPE DETECTION MECHANISM //