Chris@16
|
1 /////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
2 //
|
Chris@16
|
3 // (C) Copyright Ion Gaztanaga 2006-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_TRIVIAL_VALUE_TRAITS_HPP
|
Chris@16
|
14 #define BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
|
Chris@16
|
15
|
Chris@101
|
16 #include <boost/intrusive/detail/config_begin.hpp>
|
Chris@101
|
17 #include <boost/intrusive/intrusive_fwd.hpp>
|
Chris@16
|
18 #include <boost/intrusive/link_mode.hpp>
|
Chris@16
|
19 #include <boost/intrusive/pointer_traits.hpp>
|
Chris@16
|
20
|
Chris@101
|
21 #if defined(BOOST_HAS_PRAGMA_ONCE)
|
Chris@101
|
22 # pragma once
|
Chris@101
|
23 #endif
|
Chris@101
|
24
|
Chris@16
|
25 namespace boost {
|
Chris@16
|
26 namespace intrusive {
|
Chris@16
|
27
|
Chris@16
|
28 //!This value traits template is used to create value traits
|
Chris@16
|
29 //!from user defined node traits where value_traits::value_type and
|
Chris@16
|
30 //!node_traits::node should be equal
|
Chris@101
|
31 template<class NodeTraits, link_mode_type LinkMode
|
Chris@101
|
32 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
Chris@101
|
33 = safe_link
|
Chris@101
|
34 #endif
|
Chris@101
|
35 >
|
Chris@16
|
36 struct trivial_value_traits
|
Chris@16
|
37 {
|
Chris@16
|
38 typedef NodeTraits node_traits;
|
Chris@16
|
39 typedef typename node_traits::node_ptr node_ptr;
|
Chris@16
|
40 typedef typename node_traits::const_node_ptr const_node_ptr;
|
Chris@16
|
41 typedef typename node_traits::node value_type;
|
Chris@16
|
42 typedef node_ptr pointer;
|
Chris@16
|
43 typedef const_node_ptr const_pointer;
|
Chris@16
|
44 static const link_mode_type link_mode = LinkMode;
|
Chris@16
|
45 static node_ptr to_node_ptr (value_type &value)
|
Chris@16
|
46 { return pointer_traits<node_ptr>::pointer_to(value); }
|
Chris@16
|
47 static const_node_ptr to_node_ptr (const value_type &value)
|
Chris@16
|
48 { return pointer_traits<const_node_ptr>::pointer_to(value); }
|
Chris@16
|
49 static const pointer & to_value_ptr(const node_ptr &n) { return n; }
|
Chris@16
|
50 static const const_pointer &to_value_ptr(const const_node_ptr &n) { return n; }
|
Chris@16
|
51 };
|
Chris@16
|
52
|
Chris@16
|
53 } //namespace intrusive
|
Chris@16
|
54 } //namespace boost
|
Chris@16
|
55
|
Chris@101
|
56 #include <boost/intrusive/detail/config_end.hpp>
|
Chris@101
|
57
|
Chris@16
|
58 #endif //BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
|