diff options
Diffstat (limited to '3rdParty/Boost/src/boost/smart_ptr/detail')
5 files changed, 107 insertions, 4 deletions
diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp index 4943e37..f96a220 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp @@ -52,6 +52,10 @@ int const weak_count_id = 0x298C38A4; struct sp_nothrow_tag {}; +template< class D > struct sp_inplace_tag +{ +}; + class weak_count; class shared_count @@ -142,6 +146,40 @@ public: #endif } +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D > shared_count( P p, sp_inplace_tag<D> ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_pd< P, D >( p ); + } + catch( ... ) + { + D()( p ); // delete p + throw; + } + +#else + + pi_ = new sp_counted_impl_pd< P, D >( p ); + + if( pi_ == 0 ) + { + D()( p ); // delete p + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + template<class P, class D, class A> shared_count( P p, D d, A a ): pi_( 0 ) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) @@ -188,6 +226,56 @@ public: #endif } +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda< P, D, A > impl_type; + typedef typename A::template rebind< impl_type >::other A2; + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + catch(...) + { + D()( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + + if( pi_ != 0 ) + { + new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + else + { + D()( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + #ifndef BOOST_NO_AUTO_PTR // auto_ptr<Y> is special cased to provide the strong guarantee diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp index 397421a..aab39bd 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -135,7 +135,11 @@ public: // pre: d(p) must not throw - sp_counted_impl_pd( P p, D d ): ptr(p), del(d) + sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) + { + } + + sp_counted_impl_pd( P p ): ptr( p ), del() { } @@ -195,7 +199,11 @@ public: // pre: d( p ) must not throw - sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a ) + sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) + { + } + + sp_counted_impl_pda( P p, A a ): p_( p ), d_(), a_( a ) { } diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp index 7fcd09e..31cedbc 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp @@ -20,7 +20,7 @@ // are available. // -#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) +#if defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( BOOST_SP_NO_SYNC ) #define BOOST_SP_HAS_SYNC diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp index 1640a38..88d7ad6 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp @@ -31,7 +31,10 @@ #include <boost/config.hpp> #include <boost/smart_ptr/detail/sp_has_sync.hpp> -#if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) +#if defined( BOOST_SP_USE_PTHREADS ) +# include <boost/smart_ptr/detail/spinlock_pt.hpp> + +#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) # include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp> #elif defined( BOOST_SP_HAS_SYNC ) diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp index 0e2e08a..f09d5c6 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp @@ -41,7 +41,11 @@ public: static spinlock & spinlock_for( void const * pv ) { +#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41; +#else std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; +#endif return pool_[ i ]; } |