File indexing completed on 2025-01-30 09:44:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
0014 #define BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
0015
0016 #include <boost/intrusive/detail/config_begin.hpp>
0017 #include <boost/intrusive/intrusive_fwd.hpp>
0018 #include <boost/intrusive/link_mode.hpp>
0019 #include <boost/intrusive/pointer_traits.hpp>
0020
0021 #if defined(BOOST_HAS_PRAGMA_ONCE)
0022 # pragma once
0023 #endif
0024
0025 namespace boost {
0026 namespace intrusive {
0027
0028
0029
0030
0031
0032 template<class T, class NodeTraits, link_mode_type LinkMode
0033 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0034 = safe_link
0035 #endif
0036 >
0037 struct derivation_value_traits
0038 {
0039 public:
0040 typedef NodeTraits node_traits;
0041 typedef T value_type;
0042 typedef typename node_traits::node node;
0043 typedef typename node_traits::node_ptr node_ptr;
0044 typedef typename node_traits::const_node_ptr const_node_ptr;
0045 typedef typename pointer_traits<node_ptr>::
0046 template rebind_pointer<value_type>::type pointer;
0047 typedef typename pointer_traits<node_ptr>::
0048 template rebind_pointer<const value_type>::type const_pointer;
0049 typedef typename boost::intrusive::
0050 pointer_traits<pointer>::reference reference;
0051 typedef typename boost::intrusive::
0052 pointer_traits<const_pointer>::reference const_reference;
0053 static const link_mode_type link_mode = LinkMode;
0054
0055 BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr(reference value) BOOST_NOEXCEPT
0056 { return node_ptr(&value); }
0057
0058 BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr(const_reference value) BOOST_NOEXCEPT
0059 { return node_ptr(&value); }
0060
0061 BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(node_ptr n) BOOST_NOEXCEPT
0062 {
0063 return pointer_traits<pointer>::pointer_to(static_cast<reference>(*n));
0064 }
0065
0066 BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const_node_ptr n) BOOST_NOEXCEPT
0067 {
0068 return pointer_traits<const_pointer>::pointer_to(static_cast<const_reference>(*n));
0069 }
0070 };
0071
0072 }
0073 }
0074
0075 #include <boost/intrusive/detail/config_end.hpp>
0076
0077 #endif