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