From f898d3a1dd4bc56b6fd1f22c1ef52619f72486d3 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 27 Jan 2024 09:11:37 +0200 Subject: [PATCH] Remove BOOST_NO_CXX11_ALLOCATOR workarounds --- include/boost/function/function_base.hpp | 15 +-------------- include/boost/function/function_template.hpp | 13 +++---------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 42142d74..e8ffb06b 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -413,14 +413,9 @@ namespace boost { functor_manager_operation_type op, false_type) { typedef functor_wrapper functor_wrapper_type; -#if defined(BOOST_NO_CXX11_ALLOCATOR) - typedef typename Allocator::template rebind::other - wrapper_allocator_type; - typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; -#else + using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; -#endif if (op == clone_functor_tag) { // Clone the functor @@ -430,11 +425,7 @@ namespace boost { static_cast(in_buffer.members.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast(*f)); wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.construct(copy, *f); -#else std::allocator_traits::construct(wrapper_allocator, copy, *f); -#endif // Get back to the original pointer type functor_wrapper_type* new_f = static_cast(copy); @@ -447,11 +438,7 @@ namespace boost { functor_wrapper_type* victim = static_cast(in_buffer.members.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast(*victim)); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.destroy(victim); -#else std::allocator_traits::destroy(wrapper_allocator, victim); -#endif wrapper_allocator.deallocate(victim,1); out_buffer.members.obj_ptr = 0; } else if (op == check_functor_type_tag) { diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index dd698483..f3a524f2 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -552,21 +552,14 @@ namespace boost { assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, false_type) const { typedef functor_wrapper functor_wrapper_type; -#if defined(BOOST_NO_CXX11_ALLOCATOR) - typedef typename Allocator::template rebind::other - wrapper_allocator_type; - typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; -#else + using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; -#endif + wrapper_allocator_type wrapper_allocator(a); wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.construct(copy, functor_wrapper_type(f,a)); -#else std::allocator_traits::construct(wrapper_allocator, copy, functor_wrapper_type(f,a)); -#endif + functor_wrapper_type* new_f = static_cast(copy); functor.members.obj_ptr = new_f; }