Chris@16
|
1 /////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
2 //
|
Chris@16
|
3 // (C) Copyright Ion Gaztanaga 2007-2013
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
6 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8 //
|
Chris@16
|
9 // See http://www.boost.org/libs/intrusive for documentation.
|
Chris@16
|
10 //
|
Chris@16
|
11 /////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
12
|
Chris@16
|
13 #ifndef BOOST_INTRUSIVE_TREE_NODE_HPP
|
Chris@16
|
14 #define BOOST_INTRUSIVE_TREE_NODE_HPP
|
Chris@16
|
15
|
Chris@101
|
16 #ifndef BOOST_CONFIG_HPP
|
Chris@101
|
17 # include <boost/config.hpp>
|
Chris@101
|
18 #endif
|
Chris@101
|
19
|
Chris@101
|
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
|
Chris@101
|
21 # pragma once
|
Chris@101
|
22 #endif
|
Chris@101
|
23
|
Chris@16
|
24 #include <boost/intrusive/detail/config_begin.hpp>
|
Chris@101
|
25 #include <boost/intrusive/pointer_rebind.hpp>
|
Chris@16
|
26
|
Chris@16
|
27 namespace boost {
|
Chris@16
|
28 namespace intrusive {
|
Chris@16
|
29
|
Chris@16
|
30 template<class VoidPointer>
|
Chris@16
|
31 struct tree_node
|
Chris@16
|
32 {
|
Chris@101
|
33 typedef typename pointer_rebind<VoidPointer, tree_node>::type node_ptr;
|
Chris@16
|
34
|
Chris@16
|
35 node_ptr parent_, left_, right_;
|
Chris@16
|
36 };
|
Chris@16
|
37
|
Chris@16
|
38 template<class VoidPointer>
|
Chris@16
|
39 struct tree_node_traits
|
Chris@16
|
40 {
|
Chris@16
|
41 typedef tree_node<VoidPointer> node;
|
Chris@16
|
42
|
Chris@101
|
43 typedef typename node::node_ptr node_ptr;
|
Chris@101
|
44 typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
|
Chris@16
|
45
|
Chris@16
|
46 static node_ptr get_parent(const const_node_ptr & n)
|
Chris@16
|
47 { return n->parent_; }
|
Chris@16
|
48
|
Chris@16
|
49 static node_ptr get_parent(const node_ptr & n)
|
Chris@16
|
50 { return n->parent_; }
|
Chris@16
|
51
|
Chris@16
|
52 static void set_parent(const node_ptr & n, const node_ptr & p)
|
Chris@16
|
53 { n->parent_ = p; }
|
Chris@16
|
54
|
Chris@16
|
55 static node_ptr get_left(const const_node_ptr & n)
|
Chris@16
|
56 { return n->left_; }
|
Chris@16
|
57
|
Chris@16
|
58 static node_ptr get_left(const node_ptr & n)
|
Chris@16
|
59 { return n->left_; }
|
Chris@16
|
60
|
Chris@16
|
61 static void set_left(const node_ptr & n, const node_ptr & l)
|
Chris@16
|
62 { n->left_ = l; }
|
Chris@16
|
63
|
Chris@16
|
64 static node_ptr get_right(const const_node_ptr & n)
|
Chris@16
|
65 { return n->right_; }
|
Chris@16
|
66
|
Chris@16
|
67 static node_ptr get_right(const node_ptr & n)
|
Chris@16
|
68 { return n->right_; }
|
Chris@16
|
69
|
Chris@16
|
70 static void set_right(const node_ptr & n, const node_ptr & r)
|
Chris@16
|
71 { n->right_ = r; }
|
Chris@16
|
72 };
|
Chris@16
|
73
|
Chris@16
|
74 } //namespace intrusive
|
Chris@16
|
75 } //namespace boost
|
Chris@16
|
76
|
Chris@16
|
77 #include <boost/intrusive/detail/config_end.hpp>
|
Chris@16
|
78
|
Chris@16
|
79 #endif //BOOST_INTRUSIVE_TREE_NODE_HPP
|