Clean force_ptr usage and use launder_cast

This commit is contained in:
Ion Gaztañaga
2024-04-15 12:51:15 +02:00
parent 56cc38f761
commit 978bbb113a
17 changed files with 98 additions and 75 deletions
+4 -3
View File
@@ -23,6 +23,7 @@
#include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/placement_new.hpp>
#include <boost/move/detail/to_raw_pointer.hpp>
#include <boost/move/detail/launder.hpp>
#include <boost/container/allocator_traits.hpp>
#include <boost/container/detail/mpl.hpp>
@@ -146,7 +147,7 @@ class node_handle
}
void destroy_alloc() BOOST_NOEXCEPT
{ static_cast<nallocator_type*>((void*)m_nalloc_storage.data)->~nallocator_type(); }
{ move_detail::launder_cast<nallocator_type*>(&m_nalloc_storage)->~nallocator_type(); }
node_pointer &get_node_pointer() BOOST_NOEXCEPT
{ return m_ptr; }
@@ -381,7 +382,7 @@ class node_handle
nallocator_type &node_alloc() BOOST_NOEXCEPT
{
BOOST_ASSERT(!empty());
return *static_cast<nallocator_type*>((void*)m_nalloc_storage.data);
return *move_detail::launder_cast<nallocator_type*>(&m_nalloc_storage);
}
@@ -391,7 +392,7 @@ class node_handle
const nallocator_type &node_alloc() const BOOST_NOEXCEPT
{
BOOST_ASSERT(!empty());
return *static_cast<const nallocator_type*>((const void*)m_nalloc_storage.data);
return *move_detail::launder_cast<const nallocator_type*>(&m_nalloc_storage);
}
//! <b>Effects</b>: x.swap(y).