mirror of
https://github.com/boostorg/container.git
synced 2025-07-31 13:07:17 +02:00
Fixes #210: ("Use sized delete in boost::container::new_allocator...")
This commit is contained in:
@ -1342,6 +1342,7 @@ use [*Boost.Container]? There are several reasons for that:
|
||||
|
||||
* Fixed bugs/issues:
|
||||
* [@https://github.com/boostorg/container/issues/209 GitHub #209: ['"Some boost warnings with my R package (Wclass-memaccess warnings with std::pair)"]].
|
||||
* [@https://github.com/boostorg/container/issues/210 GitHub #210: ['"Use sized delete in boost::container::new_allocator if __cpp_sized_deallocation is defined"]].
|
||||
* [@https://github.com/boostorg/container/issues/221 GitHub #218: ['"small_vector static capacity is too small when not a multiple of 8 bytes"]].
|
||||
* [@https://github.com/boostorg/container/issues/221 GitHub #221: ['"flat_set and friends should offer a const sequence_type& sequence() const method (...)"]].
|
||||
* [@https://github.com/boostorg/container/pull/222 GitHub #222: ['"Fix incomplete type error when using list with pair"]].
|
||||
|
@ -18,6 +18,8 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
struct boost_container_new_t{};
|
||||
|
||||
//avoid including <new>
|
||||
|
@ -162,8 +162,15 @@ class new_allocator
|
||||
|
||||
//!Deallocates previously allocated memory.
|
||||
//!Never throws
|
||||
void deallocate(pointer ptr, size_type) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ ::operator delete((void*)ptr); }
|
||||
void deallocate(pointer ptr, size_type n) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
(void)n;
|
||||
# if __cpp_sized_deallocation
|
||||
::operator delete((void*)ptr, n * sizeof(T));
|
||||
#else
|
||||
::operator delete((void*)ptr);
|
||||
# endif
|
||||
}
|
||||
|
||||
//!Returns the maximum number of elements that could be allocated.
|
||||
//!Never throws
|
||||
|
Reference in New Issue
Block a user