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