summaryrefslogtreecommitdiff
path: root/boost/intrusive/detail/avltree_node.hpp
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2014-12-11 09:55:56 (GMT)
committerChanho Park <chanho61.park@samsung.com>2014-12-11 09:55:56 (GMT)
commit08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch)
tree7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/intrusive/detail/avltree_node.hpp
parentbb4dd8289b351fae6b55e303f189127a394a1edd (diff)
downloadboost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/intrusive/detail/avltree_node.hpp')
-rw-r--r--boost/intrusive/detail/avltree_node.hpp61
1 files changed, 32 insertions, 29 deletions
diff --git a/boost/intrusive/detail/avltree_node.hpp b/boost/intrusive/detail/avltree_node.hpp
index aec0dab..522806a 100644
--- a/boost/intrusive/detail/avltree_node.hpp
+++ b/boost/intrusive/detail/avltree_node.hpp
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2007-2012
+// (C) Copyright Ion Gaztanaga 2007-2013
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,9 +13,12 @@
#ifndef BOOST_INTRUSIVE_AVLTREE_NODE_HPP
#define BOOST_INTRUSIVE_AVLTREE_NODE_HPP
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
#include <boost/intrusive/detail/config_begin.hpp>
-#include <iterator>
-#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/intrusive/pointer_rebind.hpp>
#include <boost/intrusive/avltree_algorithms.hpp>
#include <boost/intrusive/pointer_plus_bits.hpp>
#include <boost/intrusive/detail/mpl.hpp>
@@ -33,9 +36,8 @@ namespace intrusive {
template<class VoidPointer>
struct compact_avltree_node
{
- typedef typename pointer_traits
- <VoidPointer>::template rebind_pointer
- <compact_avltree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_rebind<VoidPointer, compact_avltree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_rebind<VoidPointer, const compact_avltree_node<VoidPointer> >::type const_node_ptr;
enum balance { negative_t, zero_t, positive_t };
node_ptr parent_, left_, right_;
};
@@ -44,9 +46,8 @@ struct compact_avltree_node
template<class VoidPointer>
struct avltree_node
{
- typedef typename pointer_traits
- <VoidPointer>::template rebind_pointer
- <avltree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_rebind<VoidPointer, avltree_node<VoidPointer> >::type node_ptr;
+ typedef typename pointer_rebind<VoidPointer, const avltree_node<VoidPointer> >::type const_node_ptr;
enum balance { negative_t, zero_t, positive_t };
node_ptr parent_, left_, right_;
balance balance_;
@@ -58,29 +59,33 @@ template<class VoidPointer>
struct default_avltree_node_traits_impl
{
typedef avltree_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;
typedef typename node::balance balance;
- static const node_ptr & get_parent(const const_node_ptr & n)
+ static node_ptr get_parent(const const_node_ptr & n)
+ { return n->parent_; }
+
+ static node_ptr get_parent(const node_ptr & n)
{ return n->parent_; }
static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; }
- static const node_ptr & get_left(const const_node_ptr & n)
+ static node_ptr get_left(const const_node_ptr & n)
+ { return n->left_; }
+
+ static node_ptr get_left(const node_ptr & n)
{ return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; }
- static const node_ptr & get_right(const const_node_ptr & n)
+ static node_ptr get_right(const const_node_ptr & n)
+ { return n->right_; }
+
+ static node_ptr get_right(const node_ptr & n)
{ return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r)
@@ -89,6 +94,9 @@ struct default_avltree_node_traits_impl
static balance get_balance(const const_node_ptr & n)
{ return n->balance_; }
+ static balance get_balance(const node_ptr & n)
+ { return n->balance_; }
+
static void set_balance(const node_ptr & n, balance b)
{ n->balance_ = b; }
@@ -108,13 +116,8 @@ template<class VoidPointer>
struct compact_avltree_node_traits_impl
{
typedef compact_avltree_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;
typedef typename node::balance balance;
typedef pointer_plus_bits<node_ptr, 2> ptr_bit;
@@ -125,13 +128,13 @@ struct compact_avltree_node_traits_impl
static void set_parent(const node_ptr & n, const node_ptr & p)
{ ptr_bit::set_pointer(n->parent_, p); }
- static const node_ptr & get_left(const const_node_ptr & n)
+ static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; }
- static const node_ptr & get_right(const const_node_ptr & n)
+ static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r)
@@ -164,7 +167,7 @@ struct avltree_node_traits_dispatch<VoidPointer, true>
: public compact_avltree_node_traits_impl<VoidPointer>
{};
-//Inherit from the detail::link_dispatch depending on the embedding capabilities
+//Inherit from rbtree_node_traits_dispatch depending on the embedding capabilities
template<class VoidPointer, bool OptimizeSize = false>
struct avltree_node_traits
: public avltree_node_traits_dispatch