forked from boostorg/container
Use boost::container placement new to avoid ambiguities in overload resolution.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <boost/intrusive/circular_list_algorithms.hpp>
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -100,7 +101,7 @@ class block_list_base
|
||||
if((size_t(-1) - header_size) < size)
|
||||
throw_bad_alloc();
|
||||
void *p = mr.allocate(size+header_size);
|
||||
block_list_header &mb = *::new((void*)p) DerivedFromBlockListHeader;
|
||||
block_list_header &mb = *::new((void*)p, boost_container_new_t()) DerivedFromBlockListHeader;
|
||||
mb.size = size+header_size;
|
||||
list_algo::link_after(&m_list, &mb);
|
||||
return (char *)p + header_size;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <boost/container/pmr/memory_resource.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
#include <boost/intrusive/linear_slist_algorithms.hpp>
|
||||
@@ -94,7 +95,7 @@ class block_slist_base
|
||||
if((size_t(-1) - header_size) < size)
|
||||
throw_bad_alloc();
|
||||
void *p = mr.allocate(size+header_size);
|
||||
block_slist_header &mb = *::new((void*)p) DerivedFromBlockSlistHeader;
|
||||
block_slist_header &mb = *::new((void*)p, boost_container_new_t()) DerivedFromBlockSlistHeader;
|
||||
mb.size = size+header_size;
|
||||
slist_algo::link_after(&m_slist, &mb);
|
||||
return (char *)p + header_size;
|
||||
|
Reference in New Issue
Block a user