Skip to content

Commit

Permalink
Use pointer_traits casting functions instead of reference/ptr convers…
Browse files Browse the repository at this point in the history
…ions casts
  • Loading branch information
igaztanaga committed May 23, 2024
1 parent 09ab48a commit 5cf744c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions include/boost/intrusive/detail/hook_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ struct bhtraits_base
template rebind_pointer<T>::type pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const T>::type const_pointer;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<node_holder_type>::type node_holder_ptr;
typedef typename pointer_traits<node_ptr>::
template rebind_pointer<const node_holder_type>::type const_node_holder_ptr;
typedef T & reference;
typedef const T & const_reference;
typedef node_holder_type & node_holder_reference;
Expand All @@ -55,16 +59,14 @@ struct bhtraits_base

inline static pointer to_value_ptr(node_ptr n)
{
pointer p = pointer_traits<pointer>::pointer_to
(static_cast<reference>(static_cast<node_holder_reference>(*n)));
return p;
return pointer_traits<pointer>::
static_cast_from(pointer_traits<node_holder_ptr>::static_cast_from(n));
}

inline static const_pointer to_value_ptr(const_node_ptr n)
{
const_pointer p = pointer_traits<const_pointer>::pointer_to
(static_cast<const_reference>(static_cast<const_node_holder_reference>(*n)));
return p;
return pointer_traits<const_pointer>::
static_cast_from(pointer_traits<const_node_holder_ptr>::static_cast_from(n));
}

inline static node_ptr to_node_ptr(reference value)
Expand Down

0 comments on commit 5cf744c

Please sign in to comment.