mirror of
https://github.com/boostorg/container.git
synced 2026-02-24 03:52:15 +00:00
Add overaligned type support for global pmr: implement operator_new_raw_allocate/operator_delete_raw_deallocate and use them in new_delete_resource_imp
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/container/detail/dlmalloc.hpp> //For global lock
|
||||
#include <boost/container/detail/singleton.hpp>
|
||||
#include <boost/container/detail/operator_new_helpers.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
@@ -31,10 +32,10 @@ class new_delete_resource_imp
|
||||
{}
|
||||
|
||||
void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
|
||||
{ (void)bytes; (void)alignment; return new char[bytes]; }
|
||||
{ return boost::container::dtl::operator_new_raw_allocate(bytes, alignment); }
|
||||
|
||||
void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
|
||||
{ (void)bytes; (void)alignment; delete[]((char*)p); }
|
||||
{ return boost::container::dtl::operator_delete_raw_deallocate(p, bytes, alignment); }
|
||||
|
||||
bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE
|
||||
{ return &other == this; }
|
||||
|
||||
Reference in New Issue
Block a user