|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80190 - in trunk/boost/intrusive: . detail
From: igaztanaga_at_[hidden]
Date: 2012-08-25 04:18:49
Author: igaztanaga
Date: 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
New Revision: 80190
URL: http://svn.boost.org/trac/boost/changeset/80190
Log:
Uniformize traits with a macro
Text files modified:
trunk/boost/intrusive/avltree.hpp | 2
trunk/boost/intrusive/detail/utilities.hpp | 83 +++++++++++----------------------------
trunk/boost/intrusive/list.hpp | 2
trunk/boost/intrusive/options.hpp | 6 --
trunk/boost/intrusive/rbtree.hpp | 2
trunk/boost/intrusive/sgtree.hpp | 2
trunk/boost/intrusive/slist.hpp | 2
trunk/boost/intrusive/splaytree.hpp | 2
trunk/boost/intrusive/treap.hpp | 2
9 files changed, 31 insertions(+), 72 deletions(-)
Modified: trunk/boost/intrusive/avltree.hpp
==============================================================================
--- trunk/boost/intrusive/avltree.hpp (original)
+++ trunk/boost/intrusive/avltree.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -89,7 +89,7 @@
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>
Modified: trunk/boost/intrusive/detail/utilities.hpp
==============================================================================
--- trunk/boost/intrusive/detail/utilities.hpp (original)
+++ trunk/boost/intrusive/detail/utilities.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -41,64 +41,29 @@
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));
-};
-
-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;
-};
+#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;\
+};\
+//
+
+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 @@
{
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>
Modified: trunk/boost/intrusive/list.hpp
==============================================================================
--- trunk/boost/intrusive/list.hpp (original)
+++ trunk/boost/intrusive/list.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -83,7 +83,7 @@
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>
Modified: trunk/boost/intrusive/options.hpp
==============================================================================
--- trunk/boost/intrusive/options.hpp (original)
+++ trunk/boost/intrusive/options.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -57,12 +57,6 @@
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
{
Modified: trunk/boost/intrusive/rbtree.hpp
==============================================================================
--- trunk/boost/intrusive/rbtree.hpp (original)
+++ trunk/boost/intrusive/rbtree.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -89,7 +89,7 @@
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>
Modified: trunk/boost/intrusive/sgtree.hpp
==============================================================================
--- trunk/boost/intrusive/sgtree.hpp (original)
+++ trunk/boost/intrusive/sgtree.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -215,7 +215,7 @@
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>
Modified: trunk/boost/intrusive/slist.hpp
==============================================================================
--- trunk/boost/intrusive/slist.hpp (original)
+++ trunk/boost/intrusive/slist.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -112,7 +112,7 @@
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>
Modified: trunk/boost/intrusive/splaytree.hpp
==============================================================================
--- trunk/boost/intrusive/splaytree.hpp (original)
+++ trunk/boost/intrusive/splaytree.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -88,7 +88,7 @@
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>
Modified: trunk/boost/intrusive/treap.hpp
==============================================================================
--- trunk/boost/intrusive/treap.hpp (original)
+++ trunk/boost/intrusive/treap.hpp 2012-08-25 04:18:45 EDT (Sat, 25 Aug 2012)
@@ -91,7 +91,7 @@
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>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk