diff options
Diffstat (limited to 'boost/function/function_base.hpp')
-rw-r--r-- | boost/function/function_base.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/boost/function/function_base.hpp b/boost/function/function_base.hpp index b0b6608e1d..841affb49a 100644 --- a/boost/function/function_base.hpp +++ b/boost/function/function_base.hpp @@ -438,9 +438,14 @@ namespace boost { functor_manager_operation_type op, mpl::false_) { typedef functor_wrapper<Functor,Allocator> functor_wrapper_type; +#if defined(BOOST_NO_CXX11_ALLOCATOR) typedef typename Allocator::template rebind<functor_wrapper_type>::other wrapper_allocator_type; typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; +#else + using wrapper_allocator_type = typename std::allocator_traits<Allocator>::template rebind_alloc<functor_wrapper_type>; + using wrapper_allocator_pointer_type = typename std::allocator_traits<wrapper_allocator_type>::pointer; +#endif if (op == clone_functor_tag) { // Clone the functor @@ -450,7 +455,11 @@ namespace boost { static_cast<const functor_wrapper_type*>(in_buffer.members.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*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<wrapper_allocator_type>::construct(wrapper_allocator, copy, *f); +#endif // Get back to the original pointer type functor_wrapper_type* new_f = static_cast<functor_wrapper_type*>(copy); @@ -463,7 +472,11 @@ namespace boost { functor_wrapper_type* victim = static_cast<functor_wrapper_type*>(in_buffer.members.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*victim)); +#if defined(BOOST_NO_CXX11_ALLOCATOR) wrapper_allocator.destroy(victim); +#else + std::allocator_traits<wrapper_allocator_type>::destroy(wrapper_allocator, victim); +#endif wrapper_allocator.deallocate(victim,1); out_buffer.members.obj_ptr = 0; } else if (op == check_functor_type_tag) { |