diff options
Diffstat (limited to 'boost/intrusive/detail/any_node_and_algorithms.hpp')
-rw-r--r-- | boost/intrusive/detail/any_node_and_algorithms.hpp | 79 |
1 files changed, 31 insertions, 48 deletions
diff --git a/boost/intrusive/detail/any_node_and_algorithms.hpp b/boost/intrusive/detail/any_node_and_algorithms.hpp index b274135a90..5a0e8c27fe 100644 --- a/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2006-2012 +// (C) Copyright Ion Gaztanaga 2006-2014 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -13,13 +13,13 @@ #ifndef BOOST_INTRUSIVE_ANY_NODE_HPP #define BOOST_INTRUSIVE_ANY_NODE_HPP -#include <boost/intrusive/detail/config_begin.hpp> -#include <iterator> -#include <boost/intrusive/detail/assert.hpp> -#include <boost/intrusive/pointer_traits.hpp> +#if defined(_MSC_VER) +# pragma once +#endif + +#include <boost/intrusive/pointer_rebind.hpp> #include <cstddef> #include <boost/intrusive/detail/mpl.hpp> -#include <boost/pointer_cast.hpp> namespace boost { namespace intrusive { @@ -27,8 +27,9 @@ namespace intrusive { template<class VoidPointer> struct any_node { - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<any_node>::type node_ptr; + typedef any_node node; + typedef typename pointer_rebind<VoidPointer, node>::type node_ptr; + typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr; node_ptr node_ptr_1; node_ptr node_ptr_2; node_ptr node_ptr_3; @@ -38,11 +39,9 @@ struct any_node template<class VoidPointer> struct any_list_node_traits { - typedef any_node<VoidPointer> node; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<node>::type node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; + typedef any_node<VoidPointer> node; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; static const node_ptr &get_next(const const_node_ptr & n) { return n->node_ptr_1; } @@ -61,11 +60,9 @@ struct any_list_node_traits template<class VoidPointer> struct any_slist_node_traits { - typedef any_node<VoidPointer> node; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<node>::type node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; + typedef any_node<VoidPointer> node; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; static const node_ptr &get_next(const const_node_ptr & n) { return n->node_ptr_1; } @@ -110,12 +107,9 @@ struct any_unordered_node_traits template<class VoidPointer> struct any_rbtree_node_traits { - typedef any_node<VoidPointer> node; - - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<node>::type node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; + typedef any_node<VoidPointer> node; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; typedef std::size_t color; @@ -154,12 +148,10 @@ struct any_rbtree_node_traits template<class VoidPointer> struct any_avltree_node_traits { - typedef any_node<VoidPointer> node; + typedef any_node<VoidPointer> node; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<node>::type node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; typedef std::size_t balance; static const node_ptr &get_parent(const const_node_ptr & n) @@ -200,12 +192,9 @@ struct any_avltree_node_traits template<class VoidPointer> struct any_tree_node_traits { - typedef any_node<VoidPointer> node; - - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<node>::type node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; + typedef any_node<VoidPointer> node; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; static const node_ptr &get_parent(const const_node_ptr & n) { return n->node_ptr_1; } @@ -231,10 +220,8 @@ class any_node_traits { public: typedef any_node<VoidPointer> node; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<node>::type node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; }; template<class VoidPointer> @@ -245,12 +232,10 @@ class any_algorithms {} public: - typedef any_node<VoidPointer> node; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<node>::type node_ptr; - typedef typename pointer_traits - <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; - typedef any_node_traits<VoidPointer> node_traits; + typedef any_node<VoidPointer> node; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; + typedef any_node_traits<VoidPointer> node_traits; //! <b>Requires</b>: node must not be part of any tree. //! @@ -281,7 +266,7 @@ class any_algorithms any_algorithms<VoidPointer>::template function_not_available_for_any_hooks<node_ptr>(); } - static void swap_nodes(const node_ptr & l, const node_ptr & r) + static void swap_nodes(const node_ptr &, const node_ptr &) { //Any nodes have no swap_nodes capability because they don't know //what algorithm they must use to unlink the node from the container @@ -292,6 +277,4 @@ class any_algorithms } //namespace intrusive } //namespace boost -#include <boost/intrusive/detail/config_end.hpp> - #endif //BOOST_INTRUSIVE_ANY_NODE_HPP |