fix doc example typo
[boost.git] / boost / intrusive / trivial_value_traits.hpp
blobdcf996d7504beaf680a53756d577dc916c1e4f77
1 /////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2006-2008
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.
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
14 #define BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
16 #include <boost/intrusive/link_mode.hpp>
18 namespace boost {
19 namespace intrusive {
21 //!This value traits template is used to create value traits
22 //!from user defined node traits where value_traits::value_type and
23 //!node_traits::node should be equal
24 template<class NodeTraits, link_mode_type LinkMode = normal_link>
25 struct trivial_value_traits
27 typedef NodeTraits node_traits;
28 typedef typename node_traits::node_ptr node_ptr;
29 typedef typename node_traits::const_node_ptr const_node_ptr;
30 typedef typename node_traits::node value_type;
31 typedef node_ptr pointer;
32 typedef const_node_ptr const_pointer;
33 static const link_mode_type link_mode = LinkMode;
34 static node_ptr to_node_ptr (value_type &value) { return node_ptr(&value); }
35 static const_node_ptr to_node_ptr (const value_type &value) { return const_node_ptr(&value); }
36 static pointer to_value_ptr(node_ptr n) { return pointer(n); }
37 static const_pointer to_value_ptr(const_node_ptr n) { return const_pointer(n); }
40 } //namespace intrusive
41 } //namespace boost
43 #endif //BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP