From 45d6c07be6f77ac84b468e91b669d5ab9f8e9312 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Thu, 2 Mar 2023 15:47:18 -0800 Subject: [PATCH] Update emplace() to no longer needlessly rebind its allocator --- include/boost/unordered/detail/foa.hpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/include/boost/unordered/detail/foa.hpp b/include/boost/unordered/detail/foa.hpp index 5c6ca111..7770a9c2 100644 --- a/include/boost/unordered/detail/foa.hpp +++ b/include/boost/unordered/detail/foa.hpp @@ -1449,22 +1449,12 @@ public: emplace_type,element_type >::type; - using alloc_insert_type=typename std::conditional< - std::is_constructible< - value_type,emplace_type>::value, - emplace_type,value_type - >::type; - - using alloc_type= - typename boost::allocator_rebind::type; - storage s; - alloc_type alloc{al()}; auto *p=std::addressof(s.t_); - type_policy::construct(alloc,p,std::forward(args)...); + type_policy::construct(al(),p,std::forward(args)...); - drop_guard guard{alloc,p}; + drop_guard guard{al(),p}; return emplace_impl(type_policy::move(*p)); }