Chris@16
|
1 /////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
2 //
|
Chris@16
|
3 // (C) Copyright Olaf Krzikalla 2004-2006.
|
Chris@16
|
4 // (C) Copyright Ion Gaztanaga 2006-2013
|
Chris@16
|
5 //
|
Chris@16
|
6 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
7 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
8 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
9 //
|
Chris@16
|
10 // See http://www.boost.org/libs/intrusive for documentation.
|
Chris@16
|
11 //
|
Chris@16
|
12 /////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
13
|
Chris@16
|
14 #ifndef BOOST_INTRUSIVE_LIST_NODE_HPP
|
Chris@16
|
15 #define BOOST_INTRUSIVE_LIST_NODE_HPP
|
Chris@16
|
16
|
Chris@101
|
17 #ifndef BOOST_CONFIG_HPP
|
Chris@101
|
18 # include <boost/config.hpp>
|
Chris@101
|
19 #endif
|
Chris@101
|
20
|
Chris@101
|
21 #if defined(BOOST_HAS_PRAGMA_ONCE)
|
Chris@101
|
22 # pragma once
|
Chris@101
|
23 #endif
|
Chris@101
|
24
|
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 // list_node_traits can be used with circular_list_algorithms and supplies
|
Chris@16
|
31 // a list_node holding the pointers needed for a double-linked list
|
Chris@16
|
32 // it is used by list_derived_node and list_member_node
|
Chris@16
|
33
|
Chris@16
|
34 template<class VoidPointer>
|
Chris@16
|
35 struct list_node
|
Chris@16
|
36 {
|
Chris@101
|
37 typedef typename pointer_rebind<VoidPointer, list_node>::type node_ptr;
|
Chris@16
|
38 node_ptr next_;
|
Chris@16
|
39 node_ptr prev_;
|
Chris@16
|
40 };
|
Chris@16
|
41
|
Chris@16
|
42 template<class VoidPointer>
|
Chris@16
|
43 struct list_node_traits
|
Chris@16
|
44 {
|
Chris@101
|
45 typedef list_node<VoidPointer> node;
|
Chris@101
|
46 typedef typename node::node_ptr node_ptr;
|
Chris@101
|
47 typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
|
Chris@16
|
48
|
Chris@16
|
49 static node_ptr get_previous(const const_node_ptr & n)
|
Chris@16
|
50 { return n->prev_; }
|
Chris@16
|
51
|
Chris@16
|
52 static node_ptr get_previous(const node_ptr & n)
|
Chris@16
|
53 { return n->prev_; }
|
Chris@16
|
54
|
Chris@16
|
55 static void set_previous(const node_ptr & n, const node_ptr & prev)
|
Chris@16
|
56 { n->prev_ = prev; }
|
Chris@16
|
57
|
Chris@16
|
58 static node_ptr get_next(const const_node_ptr & n)
|
Chris@16
|
59 { return n->next_; }
|
Chris@16
|
60
|
Chris@16
|
61 static node_ptr get_next(const node_ptr & n)
|
Chris@16
|
62 { return n->next_; }
|
Chris@16
|
63
|
Chris@16
|
64 static void set_next(const node_ptr & n, const node_ptr & next)
|
Chris@16
|
65 { n->next_ = next; }
|
Chris@16
|
66 };
|
Chris@16
|
67
|
Chris@16
|
68 } //namespace intrusive
|
Chris@16
|
69 } //namespace boost
|
Chris@16
|
70
|
Chris@16
|
71 #endif //BOOST_INTRUSIVE_LIST_NODE_HPP
|