diff --git a/include/boost/intrusive/detail/hook_traits.hpp b/include/boost/intrusive/detail/hook_traits.hpp index c33ede0..bc51cde 100644 --- a/include/boost/intrusive/detail/hook_traits.hpp +++ b/include/boost/intrusive/detail/hook_traits.hpp @@ -46,6 +46,10 @@ struct bhtraits_base template rebind_pointer::type pointer; typedef typename pointer_traits:: template rebind_pointer::type const_pointer; + typedef typename pointer_traits:: + template rebind_pointer::type node_holder_ptr; + typedef typename pointer_traits:: + template rebind_pointer::type const_node_holder_ptr; typedef T & reference; typedef const T & const_reference; typedef node_holder_type & node_holder_reference; @@ -55,16 +59,14 @@ struct bhtraits_base inline static pointer to_value_ptr(node_ptr n) { - pointer p = pointer_traits::pointer_to - (static_cast(static_cast(*n))); - return p; + return pointer_traits:: + static_cast_from(pointer_traits::static_cast_from(n)); } inline static const_pointer to_value_ptr(const_node_ptr n) { - const_pointer p = pointer_traits::pointer_to - (static_cast(static_cast(*n))); - return p; + return pointer_traits:: + static_cast_from(pointer_traits::static_cast_from(n)); } inline static node_ptr to_node_ptr(reference value) diff --git a/include/boost/intrusive/pointer_traits.hpp b/include/boost/intrusive/pointer_traits.hpp index 48d984e..1b2ed05 100644 --- a/include/boost/intrusive/pointer_traits.hpp +++ b/include/boost/intrusive/pointer_traits.hpp @@ -130,7 +130,7 @@ struct pointer_traits //! //! Note: For non-conforming compilers only the existence of a member function called //! pointer_to is checked. - inline static pointer pointer_to(reference r) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer pointer_to(reference r) BOOST_NOEXCEPT { //Non-standard extension, it does not require Ptr::pointer_to. If not present //tries to converts &r to pointer. @@ -150,7 +150,7 @@ struct pointer_traits //! Note: For non-conforming compilers only the existence of a member function called //! static_cast_from is checked. template - inline static pointer static_cast_from(const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer static_cast_from(const UPtr &uptr) BOOST_NOEXCEPT { typedef const UPtr &RefArg; const bool value = boost::intrusive::detail:: @@ -171,7 +171,7 @@ struct pointer_traits //! Note: For non-conforming compilers only the existence of a member function called //! const_cast_from is checked. template - inline static pointer const_cast_from(const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer const_cast_from(const UPtr &uptr) BOOST_NOEXCEPT { typedef const UPtr &RefArg; const bool value = boost::intrusive::detail:: @@ -192,7 +192,7 @@ struct pointer_traits //! Note: For non-conforming compilers only the existence of a member function called //! dynamic_cast_from is checked. template - inline static pointer dynamic_cast_from(const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer dynamic_cast_from(const UPtr &uptr) BOOST_NOEXCEPT { typedef const UPtr &RefArg; const bool value = boost::intrusive::detail:: @@ -208,46 +208,46 @@ struct pointer_traits private: //priv_to_raw_pointer template - inline static T* to_raw_pointer(T* p) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static T* to_raw_pointer(T* p) BOOST_NOEXCEPT { return p; } template - inline static typename pointer_traits::element_type* + BOOST_INTRUSIVE_FORCEINLINE static typename pointer_traits::element_type* to_raw_pointer(const Pointer &p) BOOST_NOEXCEPT { return pointer_traits::to_raw_pointer(p.operator->()); } //priv_pointer_to - inline static pointer priv_pointer_to(boost::intrusive::detail::true_, reference r) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_pointer_to(boost::intrusive::detail::true_, reference r) BOOST_NOEXCEPT { return Ptr::pointer_to(r); } - inline static pointer priv_pointer_to(boost::intrusive::detail::false_, reference r) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_pointer_to(boost::intrusive::detail::false_, reference r) BOOST_NOEXCEPT { return pointer(boost::intrusive::detail::addressof(r)); } //priv_static_cast_from template - inline static pointer priv_static_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_static_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) BOOST_NOEXCEPT { return Ptr::static_cast_from(uptr); } template - inline static pointer priv_static_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_static_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) BOOST_NOEXCEPT { return uptr ? pointer_to(*static_cast(to_raw_pointer(uptr))) : pointer(); } //priv_const_cast_from template - inline static pointer priv_const_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_const_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) BOOST_NOEXCEPT { return Ptr::const_cast_from(uptr); } template - inline static pointer priv_const_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_const_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) BOOST_NOEXCEPT { return uptr ? pointer_to(const_cast(*uptr)) : pointer(); } //priv_dynamic_cast_from template - inline static pointer priv_dynamic_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_dynamic_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) BOOST_NOEXCEPT { return Ptr::dynamic_cast_from(uptr); } template - inline static pointer priv_dynamic_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_dynamic_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) BOOST_NOEXCEPT { return uptr ? pointer_to(dynamic_cast(*uptr)) : pointer(); } ///@endcond }; @@ -296,25 +296,25 @@ struct pointer_traits //! Returns: addressof(r) //! - inline static pointer pointer_to(reference r) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer pointer_to(reference r) BOOST_NOEXCEPT { return boost::intrusive::detail::addressof(r); } //! Returns: static_cast(uptr) //! template - inline static pointer static_cast_from(U *uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer static_cast_from(U *uptr) BOOST_NOEXCEPT { return static_cast(uptr); } //! Returns: const_cast(uptr) //! template - inline static pointer const_cast_from(U *uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer const_cast_from(U *uptr) BOOST_NOEXCEPT { return const_cast(uptr); } //! Returns: dynamic_cast(uptr) //! template - inline static pointer dynamic_cast_from(U *uptr) BOOST_NOEXCEPT + BOOST_INTRUSIVE_FORCEINLINE static pointer dynamic_cast_from(U *uptr) BOOST_NOEXCEPT { return dynamic_cast(uptr); } };