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

source code of boost/boost/intrusive/trivial_value_traits.hpp