1 | ///////////////////////////////////////////////////////////////////////////// |
---|---|
2 | // |
3 | // (C) Copyright Olaf Krzikalla 2004-2006. |
4 | // (C) Copyright Ion Gaztanaga 2006-2013 |
5 | // |
6 | // Distributed under the Boost Software License, Version 1.0. |
7 | // (See accompanying file LICENSE_1_0.txt or copy at |
8 | // http://www.boost.org/LICENSE_1_0.txt) |
9 | // |
10 | // See http://www.boost.org/libs/intrusive for documentation. |
11 | // |
12 | ///////////////////////////////////////////////////////////////////////////// |
13 | |
14 | #ifndef BOOST_INTRUSIVE_SLIST_NODE_HPP |
15 | #define BOOST_INTRUSIVE_SLIST_NODE_HPP |
16 | |
17 | #ifndef BOOST_CONFIG_HPP |
18 | # include <boost/config.hpp> |
19 | #endif |
20 | |
21 | #if defined(BOOST_HAS_PRAGMA_ONCE) |
22 | # pragma once |
23 | #endif |
24 | |
25 | #include <boost/intrusive/detail/config_begin.hpp> |
26 | #include <boost/intrusive/detail/workaround.hpp> |
27 | #include <boost/intrusive/pointer_rebind.hpp> |
28 | |
29 | namespace boost { |
30 | namespace intrusive { |
31 | |
32 | template<class VoidPointer> |
33 | struct slist_node |
34 | { |
35 | typedef typename pointer_rebind<VoidPointer, slist_node>::type node_ptr; |
36 | node_ptr next_; |
37 | }; |
38 | |
39 | // slist_node_traits can be used with circular_slist_algorithms and supplies |
40 | // a slist_node holding the pointers needed for a singly-linked list |
41 | // it is used by slist_base_hook and slist_member_hook |
42 | template<class VoidPointer> |
43 | struct slist_node_traits |
44 | { |
45 | typedef slist_node<VoidPointer> node; |
46 | typedef typename node::node_ptr node_ptr; |
47 | typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr; |
48 | |
49 | BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n) |
50 | { return n->next_; } |
51 | |
52 | BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const node_ptr & n) |
53 | { return n->next_; } |
54 | |
55 | BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next) |
56 | { n->next_ = next; } |
57 | }; |
58 | |
59 | } //namespace intrusive |
60 | } //namespace boost |
61 | |
62 | #include <boost/intrusive/detail/config_end.hpp> |
63 | |
64 | #endif //BOOST_INTRUSIVE_SLIST_NODE_HPP |
65 |