mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-03 22:44:43 +02:00
Uniformize traits with a macro
[SVN r80190]
This commit is contained in:
@@ -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_traits>::value;
|
||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||
typedef typename detail::eval_if_c
|
||||
< external_value_traits
|
||||
, detail::eval_value_traits<value_traits>
|
||||
|
@@ -41,64 +41,29 @@ struct internal_member_value_traits
|
||||
static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct internal_base_hook_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::boost_intrusive_tags::is_base_hook> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
#define BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(TRAITS_PREFIX, TYPEDEF_TO_FIND) \
|
||||
template <class T>\
|
||||
struct TRAITS_PREFIX##_bool\
|
||||
{\
|
||||
template<bool Add>\
|
||||
struct two_or_three {one _[2 + Add];};\
|
||||
template <class U> static one test(...);\
|
||||
template <class U> static two_or_three<U::TYPEDEF_TO_FIND> test (int);\
|
||||
static const std::size_t value = sizeof(test<T>(0));\
|
||||
};\
|
||||
\
|
||||
template <class T>\
|
||||
struct TRAITS_PREFIX##_bool_is_true\
|
||||
{\
|
||||
static const bool value = TRAITS_PREFIX##_bool<T>::value > sizeof(one)*2;\
|
||||
};\
|
||||
//
|
||||
|
||||
template <class T>
|
||||
struct internal_base_hook_bool_is_true
|
||||
{
|
||||
static const bool value = internal_base_hook_bool<T>::value > sizeof(one)*2;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct internal_any_hook_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::is_any_hook> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct internal_any_hook_bool_is_true
|
||||
{
|
||||
static const bool value = internal_any_hook_bool<T>::value > sizeof(one)*2;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct external_value_traits_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::external_value_traits> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct external_bucket_traits_bool
|
||||
{
|
||||
template<bool Add>
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::external_bucket_traits> test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct external_value_traits_is_true
|
||||
{
|
||||
static const bool value = external_value_traits_bool<T>::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<class Node, class Tag, link_mode_type LinkMode, int>
|
||||
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_traits, external_value_traits_is_true<value_traits>::value>::value;
|
||||
<value_traits, external_value_traits_bool_is_true<value_traits>::value>::value;
|
||||
};
|
||||
|
||||
template<class Container, bool IsConst>
|
||||
|
@@ -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_traits>::value;
|
||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||
typedef typename detail::eval_if_c
|
||||
< external_value_traits
|
||||
, detail::eval_value_traits<value_traits>
|
||||
|
@@ -57,12 +57,6 @@ struct eval_value_traits
|
||||
typedef typename ValueTraits::value_traits type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct external_bucket_traits_is_true
|
||||
{
|
||||
static const bool value = external_bucket_traits_bool<T>::value == 3;
|
||||
};
|
||||
|
||||
template <class BucketTraits>
|
||||
struct eval_bucket_traits
|
||||
{
|
||||
|
@@ -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_traits>::value;
|
||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||
typedef typename detail::eval_if_c
|
||||
< external_value_traits
|
||||
, detail::eval_value_traits<value_traits>
|
||||
|
@@ -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_traits>::value;
|
||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||
typedef typename detail::eval_if_c
|
||||
< external_value_traits
|
||||
, detail::eval_value_traits<value_traits>
|
||||
|
@@ -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_traits>::value;
|
||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||
typedef typename detail::eval_if_c
|
||||
< external_value_traits
|
||||
, detail::eval_value_traits<value_traits>
|
||||
|
@@ -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_traits>::value;
|
||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||
typedef typename detail::eval_if_c
|
||||
< external_value_traits
|
||||
, detail::eval_value_traits<value_traits>
|
||||
|
@@ -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_traits>::value;
|
||||
detail::external_value_traits_bool_is_true<value_traits>::value;
|
||||
typedef typename detail::eval_if_c
|
||||
< external_value_traits
|
||||
, detail::eval_value_traits<value_traits>
|
||||
|
Reference in New Issue
Block a user