diff --git a/include/boost/intrusive/avltree.hpp b/include/boost/intrusive/avltree.hpp index 84376a8..c936f37 100644 --- a/include/boost/intrusive/avltree.hpp +++ b/include/boost/intrusive/avltree.hpp @@ -89,7 +89,7 @@ class avltree_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits diff --git a/include/boost/intrusive/detail/utilities.hpp b/include/boost/intrusive/detail/utilities.hpp index c6bc798..722a7a3 100644 --- a/include/boost/intrusive/detail/utilities.hpp +++ b/include/boost/intrusive/detail/utilities.hpp @@ -41,64 +41,29 @@ struct internal_member_value_traits static const bool value = sizeof(test(0)) == sizeof(detail::two); }; -template -struct internal_base_hook_bool -{ - template - struct two_or_three {one _[2 + Add];}; - template static one test(...); - template static two_or_three test (int); - static const std::size_t value = sizeof(test(0)); -}; +#define BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(TRAITS_PREFIX, TYPEDEF_TO_FIND) \ +template \ +struct TRAITS_PREFIX##_bool\ +{\ + template\ + struct two_or_three {one _[2 + Add];};\ + template static one test(...);\ + template static two_or_three test (int);\ + static const std::size_t value = sizeof(test(0));\ +};\ +\ +template \ +struct TRAITS_PREFIX##_bool_is_true\ +{\ + static const bool value = TRAITS_PREFIX##_bool::value > sizeof(one)*2;\ +};\ +// -template -struct internal_base_hook_bool_is_true -{ - static const bool value = internal_base_hook_bool::value > sizeof(one)*2; -}; - -template -struct internal_any_hook_bool -{ - template - struct two_or_three {one _[2 + Add];}; - template static one test(...); - template static two_or_three test (int); - static const std::size_t value = sizeof(test(0)); -}; - -template -struct internal_any_hook_bool_is_true -{ - static const bool value = internal_any_hook_bool::value > sizeof(one)*2; -}; - - -template -struct external_value_traits_bool -{ - template - struct two_or_three {one _[2 + Add];}; - template static one test(...); - template static two_or_three test (int); - static const std::size_t value = sizeof(test(0)); -}; - -template -struct external_bucket_traits_bool -{ - template - struct two_or_three {one _[2 + Add];}; - template static one test(...); - template static two_or_three test (int); - static const std::size_t value = sizeof(test(0)); -}; - -template -struct external_value_traits_is_true -{ - static const bool value = external_value_traits_bool::value > sizeof(one)*2; -}; +BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, boost_intrusive_tags::is_base_hook) +BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook) +BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_value_traits, external_value_traits) +BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_bucket_traits, external_bucket_traits) +BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(resizable, resizable) template struct node_holder @@ -644,7 +609,7 @@ struct store_cont_ptr_on_it { typedef typename Container::value_traits value_traits; static const bool value = store_cont_ptr_on_it_impl - ::value>::value; + ::value>::value; }; template diff --git a/include/boost/intrusive/list.hpp b/include/boost/intrusive/list.hpp index 5450bc5..569d942 100644 --- a/include/boost/intrusive/list.hpp +++ b/include/boost/intrusive/list.hpp @@ -83,7 +83,7 @@ class list_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits diff --git a/include/boost/intrusive/options.hpp b/include/boost/intrusive/options.hpp index e657438..b1dd944 100644 --- a/include/boost/intrusive/options.hpp +++ b/include/boost/intrusive/options.hpp @@ -57,12 +57,6 @@ struct eval_value_traits typedef typename ValueTraits::value_traits type; }; -template -struct external_bucket_traits_is_true -{ - static const bool value = external_bucket_traits_bool::value == 3; -}; - template struct eval_bucket_traits { diff --git a/include/boost/intrusive/rbtree.hpp b/include/boost/intrusive/rbtree.hpp index 1c0c30e..2f3ee56 100644 --- a/include/boost/intrusive/rbtree.hpp +++ b/include/boost/intrusive/rbtree.hpp @@ -89,7 +89,7 @@ class rbtree_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits diff --git a/include/boost/intrusive/sgtree.hpp b/include/boost/intrusive/sgtree.hpp index f181f54..00de67f 100644 --- a/include/boost/intrusive/sgtree.hpp +++ b/include/boost/intrusive/sgtree.hpp @@ -215,7 +215,7 @@ class sgtree_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits diff --git a/include/boost/intrusive/slist.hpp b/include/boost/intrusive/slist.hpp index d7fc131..6c9ac53 100644 --- a/include/boost/intrusive/slist.hpp +++ b/include/boost/intrusive/slist.hpp @@ -112,7 +112,7 @@ class slist_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits diff --git a/include/boost/intrusive/splaytree.hpp b/include/boost/intrusive/splaytree.hpp index a1c5209..e559ee7 100644 --- a/include/boost/intrusive/splaytree.hpp +++ b/include/boost/intrusive/splaytree.hpp @@ -88,7 +88,7 @@ class splaytree_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits diff --git a/include/boost/intrusive/treap.hpp b/include/boost/intrusive/treap.hpp index b539acc..006b2d9 100644 --- a/include/boost/intrusive/treap.hpp +++ b/include/boost/intrusive/treap.hpp @@ -91,7 +91,7 @@ class treap_impl typedef typename Config::value_traits value_traits; /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits