diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-08-02 20:41:55 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-08-02 21:03:09 (GMT) |
commit | d5ace22054203c7989691ae8b3fa4e4784d1b57e (patch) | |
tree | 64d400cdb10644967df183d0f202fcbf8160a773 /3rdParty/Boost/src/boost/smart_ptr | |
parent | 6f26d9aa86f0909af13b23b1a925b8d492e74154 (diff) | |
download | swift-contrib-ks/boost1.47.zip swift-contrib-ks/boost1.47.tar.bz2 |
Add two extra Boost dependencies, upgrade to 1.47.0ks/boost1.47
Diffstat (limited to '3rdParty/Boost/src/boost/smart_ptr')
8 files changed, 613 insertions, 45 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 ]; } diff --git a/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp index e72eb21..2fa4670 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp @@ -15,11 +15,6 @@ #include <boost/config.hpp> -#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash -# pragma warning(push) -# pragma warning(disable:4284) // odd return type for operator-> -#endif - #include <boost/assert.hpp> #include <boost/detail/workaround.hpp> #include <boost/smart_ptr/detail/sp_convertible.hpp> @@ -292,8 +287,4 @@ template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std:: } // namespace boost -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - #endif // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp b/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp index c4ed28a..7b605e2 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp @@ -49,7 +49,18 @@ private: { if( initialized_ ) { +#if defined( __GNUC__ ) + + // fixes incorrect aliasing warning + T * p = reinterpret_cast< T* >( storage_.data_ ); + p->~T(); + +#else + reinterpret_cast< T* >( storage_.data_ )->~T(); + +#endif + initialized_ = false; } } @@ -97,13 +108,19 @@ template< class T > T&& sp_forward( T & t ) } // namespace detail +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) +# define BOOST_SP_MSD( T ) boost::detail::sp_inplace_tag< boost::detail::sp_ms_deleter< T > >() +#else +# define BOOST_SP_MSD( T ) boost::detail::sp_ms_deleter< T >() +#endif + // Zero-argument versions // // Used even when variadic templates are available because of the new T() vs new T issue template< class T > boost::shared_ptr< T > make_shared() { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -120,7 +137,7 @@ template< class T > boost::shared_ptr< T > make_shared() template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -141,7 +158,7 @@ template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_shared( Arg1 && arg1, Args && ... args ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -158,7 +175,7 @@ template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_share template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Arg1 && arg1, Args && ... args ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -173,6 +190,460 @@ template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > a return boost::shared_ptr< T >( pt, pt2 ); } +#elif defined( BOOST_HAS_RVALUE_REFS ) + +// For example MSVC 10.0 + +template< class T, class A1 > +boost::shared_ptr< T > make_shared( A1 && a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ), + boost::detail::sp_forward<A9>( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ), + boost::detail::sp_forward<A9>( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + #else // C++03 version @@ -180,7 +651,7 @@ template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > a template< class T, class A1 > boost::shared_ptr< T > make_shared( A1 const & a1 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -198,7 +669,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1 ) template< class T, class A, class A1 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -216,7 +687,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 ) template< class T, class A1, class A2 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -234,7 +705,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 ) template< class T, class A, class A1, class A2 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -252,7 +723,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -270,7 +741,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3 template< class T, class A, class A1, class A2, class A3 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -288,7 +759,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -306,7 +777,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -324,7 +795,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -342,7 +813,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -360,7 +831,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -378,7 +849,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -396,7 +867,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -414,7 +885,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -432,7 +903,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -450,7 +921,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -468,7 +939,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -486,7 +957,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -503,6 +974,8 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a #endif +#undef BOOST_SP_MSD + } // namespace boost #endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp index 609cce9..100f1a8 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp @@ -41,6 +41,7 @@ #include <algorithm> // for std::swap #include <functional> // for std::less #include <typeinfo> // for std::bad_cast +#include <cstddef> // for std::size_t #if !defined(BOOST_NO_IOSTREAM) #if !defined(BOOST_NO_IOSFWD) @@ -50,11 +51,6 @@ #endif #endif -#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash -# pragma warning(push) -# pragma warning(disable:4284) // odd return type for operator-> -#endif - namespace boost { @@ -688,13 +684,18 @@ template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * return atomic_compare_exchange( p, v, w ); // std::move( w ) } -#endif +#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) -} // namespace boost +// hash_value -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif +template< class T > struct hash; + +template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) +{ + return boost::hash< T* >()( p.get() ); +} + +} // namespace boost #endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) |