diff --git a/include/boost/smart_ptr/allocate_local_shared_array.hpp b/include/boost/smart_ptr/allocate_local_shared_array.hpp index 89d3285..fd87329 100644 --- a/include/boost/smart_ptr/allocate_local_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_local_shared_array.hpp @@ -74,7 +74,7 @@ inline typename enable_if_::value, allocate_local_shared(const A& allocator, std::size_t count) { typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::lsp_array_state state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); @@ -97,7 +97,7 @@ allocate_local_shared(const A& allocator) count = extent::value }; typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::lsp_size_array_state state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); @@ -118,7 +118,7 @@ allocate_local_shared(const A& allocator, std::size_t count, const typename remove_extent::type& value) { typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::lsp_array_state state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); @@ -142,7 +142,7 @@ allocate_local_shared(const A& allocator, count = extent::value }; typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::lsp_size_array_state state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index 9bf7322..5f00d91 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -8,6 +8,7 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP #define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP +#include #include #include #include @@ -57,18 +58,6 @@ struct sp_align_up { }; }; -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -struct sp_bind_allocator { - typedef typename std::allocator_traits::template rebind_alloc type; -}; -#else -template -struct sp_bind_allocator { - typedef typename A::template rebind::other type; -}; -#endif - template BOOST_CONSTEXPR inline std::size_t sp_objects(std::size_t size) BOOST_SP_NOEXCEPT @@ -171,7 +160,7 @@ public: } private: - typename sp_bind_allocator::type other_; + typename boost::allocator_rebind::type other_; std::size_t size_; }; @@ -273,7 +262,7 @@ inline typename enable_if_::value, shared_ptr >::type allocate_shared(const A& allocator, std::size_t count) { typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::sp_array_state state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); @@ -293,7 +282,7 @@ allocate_shared(const A& allocator) count = extent::value }; typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::sp_size_array_state::value> state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); @@ -311,7 +300,7 @@ allocate_shared(const A& allocator, std::size_t count, const typename remove_extent::type& value) { typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::sp_array_state state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); @@ -332,7 +321,7 @@ allocate_shared(const A& allocator, count = extent::value }; typedef typename detail::sp_array_element::type element; - typedef typename detail::sp_bind_allocator::type other; + typedef typename allocator_rebind::type other; typedef detail::sp_size_array_state::value> state; typedef detail::sp_array_base base; detail::sp_array_result result(allocator, count); diff --git a/include/boost/smart_ptr/allocate_unique.hpp b/include/boost/smart_ptr/allocate_unique.hpp index a4746c0..3738b38 100644 --- a/include/boost/smart_ptr/allocate_unique.hpp +++ b/include/boost/smart_ptr/allocate_unique.hpp @@ -10,6 +10,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#include #include #include #include @@ -61,30 +62,6 @@ struct sp_alloc_value { boost::remove_extent::type>::type type; }; -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -struct sp_alloc_to { - typedef typename std::allocator_traits::template rebind_alloc type; -}; -#else -template -struct sp_alloc_to { - typedef typename A::template rebind::other type; -}; -#endif - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -struct sp_alloc_type { - typedef typename std::allocator_traits::pointer type; -}; -#else -template -struct sp_alloc_type { - typedef typename A::pointer type; -}; -#endif - template class sp_alloc_ptr { public: @@ -296,7 +273,7 @@ operator!=(detail::sp_nullptr_t, template inline void -sp_alloc_clear(A& a, typename sp_alloc_type::type p, std::size_t, +sp_alloc_clear(A& a, typename boost::allocator_pointer::type p, std::size_t, boost::false_type) { boost::alloc_destroy(a, boost::to_address(p)); @@ -304,8 +281,8 @@ sp_alloc_clear(A& a, typename sp_alloc_type::type p, std::size_t, template inline void -sp_alloc_clear(A& a, typename sp_alloc_type::type p, std::size_t n, - boost::true_type) +sp_alloc_clear(A& a, typename boost::allocator_pointer::type p, + std::size_t n, boost::true_type) { #if defined(BOOST_MSVC) && BOOST_MSVC < 1800 if (!p) { @@ -320,15 +297,15 @@ sp_alloc_clear(A& a, typename sp_alloc_type::type p, std::size_t n, template class alloc_deleter - : empty_value::type>::type> { - typedef typename detail::sp_alloc_to::type>::type allocator; typedef empty_value base; public: typedef detail::sp_alloc_ptr::type> pointer; + typename allocator_pointer::type> pointer; explicit alloc_deleter(const allocator& a) BOOST_SP_NOEXCEPT : base(empty_init_t(), a) { } @@ -349,7 +326,7 @@ namespace detail { template class sp_alloc_make { public: - typedef typename sp_alloc_to::type>::type allocator; private: @@ -384,7 +361,7 @@ public: } private: - typedef typename sp_alloc_type::type pointer; + typedef typename boost::allocator_pointer::type pointer; allocator a_; std::size_t n_;