From 5cf744c4b3ebad328d53f76fd0ce540b8789aa65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 23 May 2024 22:31:41 +0200 Subject: [PATCH] Use pointer_traits casting functions instead of reference/ptr conversions casts --- include/boost/intrusive/detail/hook_traits.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/boost/intrusive/detail/hook_traits.hpp b/include/boost/intrusive/detail/hook_traits.hpp index c33ede0d..bc51cdeb 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)