summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp')
-rw-r--r--3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp88
1 files changed, 88 insertions, 0 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