Clean up usage of Allocators for flat containers

This commit is contained in:
Christian Mazakas
2023-03-02 15:48:21 -08:00
parent 5f6f1691e5
commit 088941dc7b
2 changed files with 5 additions and 9 deletions

View File

@ -72,13 +72,9 @@ namespace boost {
} }
template <class A, class... Args> template <class A, class... Args>
static void construct(A& al, element_type* p, Args&&... args) static void construct(A& al, value_type* p, Args&&... args)
{ {
using alloc_type = boost::allocator_construct(al, p, std::forward<Args>(args)...);
typename boost::allocator_rebind<A, value_type>::type;
alloc_type alloc(al);
std::allocator_traits<alloc_type>::construct(
alloc, p, std::forward<Args>(args)...);
} }
template <class A> static void destroy(A& al, init_type* p) noexcept template <class A> static void destroy(A& al, init_type* p) noexcept
@ -86,7 +82,7 @@ namespace boost {
boost::allocator_destroy(al, p); boost::allocator_destroy(al, p);
} }
template <class A> static void destroy(A& al, element_type* p) noexcept template <class A> static void destroy(A& al, value_type* p) noexcept
{ {
boost::allocator_destroy(al, p); boost::allocator_destroy(al, p);
} }

View File

@ -46,12 +46,12 @@ namespace boost {
static element_type&& move(element_type& x) { return std::move(x); } static element_type&& move(element_type& x) { return std::move(x); }
template <class A, class... Args> template <class A, class... Args>
static void construct(A& al, element_type* p, Args&&... args) static void construct(A& al, value_type* p, Args&&... args)
{ {
boost::allocator_construct(al, p, std::forward<Args>(args)...); boost::allocator_construct(al, p, std::forward<Args>(args)...);
} }
template <class A> static void destroy(A& al, element_type* p) noexcept template <class A> static void destroy(A& al, value_type* p) noexcept
{ {
boost::allocator_destroy(al, p); boost::allocator_destroy(al, p);
} }