From 088941dc7b04f769de667ecf6843391d937b981f Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Thu, 2 Mar 2023 15:48:21 -0800 Subject: [PATCH] Clean up usage of Allocators for flat containers --- include/boost/unordered/unordered_flat_map.hpp | 10 +++------- include/boost/unordered/unordered_flat_set.hpp | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/boost/unordered/unordered_flat_map.hpp b/include/boost/unordered/unordered_flat_map.hpp index 758694a1..df2717c6 100644 --- a/include/boost/unordered/unordered_flat_map.hpp +++ b/include/boost/unordered/unordered_flat_map.hpp @@ -72,13 +72,9 @@ namespace boost { } template - static void construct(A& al, element_type* p, Args&&... args) + static void construct(A& al, value_type* p, Args&&... args) { - using alloc_type = - typename boost::allocator_rebind::type; - alloc_type alloc(al); - std::allocator_traits::construct( - alloc, p, std::forward(args)...); + boost::allocator_construct(al, p, std::forward(args)...); } template static void destroy(A& al, init_type* p) noexcept @@ -86,7 +82,7 @@ namespace boost { boost::allocator_destroy(al, p); } - template static void destroy(A& al, element_type* p) noexcept + template static void destroy(A& al, value_type* p) noexcept { boost::allocator_destroy(al, p); } diff --git a/include/boost/unordered/unordered_flat_set.hpp b/include/boost/unordered/unordered_flat_set.hpp index 8829742e..2138a9f3 100644 --- a/include/boost/unordered/unordered_flat_set.hpp +++ b/include/boost/unordered/unordered_flat_set.hpp @@ -46,12 +46,12 @@ namespace boost { static element_type&& move(element_type& x) { return std::move(x); } template - 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)...); } - template static void destroy(A& al, element_type* p) noexcept + template static void destroy(A& al, value_type* p) noexcept { boost::allocator_destroy(al, p); }