diff options
Diffstat (limited to '3party/boost/boost/smart_ptr/detail/shared_count.hpp')
-rw-r--r-- | 3party/boost/boost/smart_ptr/detail/shared_count.hpp | 80 |
1 files changed, 76 insertions, 4 deletions
diff --git a/3party/boost/boost/smart_ptr/detail/shared_count.hpp b/3party/boost/boost/smart_ptr/detail/shared_count.hpp index 8e1dd4810a..1e7d688c1a 100644 --- a/3party/boost/boost/smart_ptr/detail/shared_count.hpp +++ b/3party/boost/boost/smart_ptr/detail/shared_count.hpp @@ -225,16 +225,35 @@ public: #endif { typedef sp_counted_impl_pda<P, D, A> impl_type; + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits<A>::template rebind_alloc< impl_type > A2; + +#else + typedef typename A::template rebind< impl_type >::other A2; +#endif + A2 a2( a ); #ifndef BOOST_NO_EXCEPTIONS try { +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 ); + pi_ = pi; + std::allocator_traits<A2>::construct( a2, pi, p, d, a ); + +#else + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); - new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + +#endif } catch(...) { @@ -250,11 +269,28 @@ public: #else +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 ); + pi_ = pi; + +#else + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); +#endif + if( pi_ != 0 ) { - new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + std::allocator_traits<A2>::construct( a2, pi, p, d, a ); + +#else + + ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + +#endif } else { @@ -273,16 +309,35 @@ public: #endif { typedef sp_counted_impl_pda< P, D, A > impl_type; + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits<A>::template rebind_alloc< impl_type > A2; + +#else + typedef typename A::template rebind< impl_type >::other A2; +#endif + A2 a2( a ); #ifndef BOOST_NO_EXCEPTIONS try { +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 ); + pi_ = pi; + std::allocator_traits<A2>::construct( a2, pi, p, a ); + +#else + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); - new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + +#endif } catch(...) { @@ -298,11 +353,28 @@ public: #else +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 ); + pi_ = pi; + +#else + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); +#endif + if( pi_ != 0 ) { - new( static_cast< void* >( pi_ ) ) impl_type( p, a ); +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + std::allocator_traits<A2>::construct( a2, pi, p, a ); + +#else + + ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + +#endif } else { |