]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/intrusive/detail/tree_node.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / intrusive / detail / tree_node.hpp
CommitLineData
7c673cae
FG
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
28namespace boost {
29namespace intrusive {
30
31template<class VoidPointer>
32struct tree_node
33{
34 typedef typename pointer_rebind<VoidPointer, tree_node>::type node_ptr;
35
36 node_ptr parent_, left_, right_;
37};
38
39template<class VoidPointer>
40struct 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
92f5a8d4 53 BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p)
7c673cae
FG
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
92f5a8d4 62 BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l)
7c673cae
FG
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
92f5a8d4 71 BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r)
7c673cae
FG
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