1 #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED 2 #define BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED 6 #if defined(_MSC_VER) && (_MSC_VER >= 1020) 22 # pragma warn -8027 // Functions containing try are not expanded inline 39 #ifdef BOOST_NO_EXCEPTIONS 43 #if !defined( BOOST_NO_CXX11_SMART_PTR ) 44 # include <boost/utility/addressof.hpp> 53 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 55 int const shared_count_id = 0x2C35F101;
56 int const weak_count_id = 0x298C38A4;
66 #if !defined( BOOST_NO_CXX11_SMART_PTR ) 106 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 115 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
116 , id_(shared_count_id)
122 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
123 , id_(shared_count_id)
126 #ifndef BOOST_NO_EXCEPTIONS 151 #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) 152 template<
class Y,
class D>
shared_count( Y * p, D d ): pi_(0)
156 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
157 , id_(shared_count_id)
160 #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) 163 #ifndef BOOST_NO_EXCEPTIONS 188 #if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) 191 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
192 , id_(shared_count_id)
195 #ifndef BOOST_NO_EXCEPTIONS 217 #endif // #ifndef BOOST_NO_EXCEPTIONS 220 #endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) 222 template<
class P,
class D,
class A>
shared_count( P p, D d, A a ): pi_( 0 )
223 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
224 , id_(shared_count_id)
228 typedef typename A::template rebind< impl_type >::other A2;
232 #ifndef BOOST_NO_EXCEPTIONS 236 pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
237 new(
static_cast< void*
>( pi_ ) ) impl_type( p, d, a );
245 a2.deallocate( static_cast< impl_type* >( pi_ ), 1 );
253 pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
257 new(
static_cast< void*
>( pi_ ) ) impl_type( p, d, a );
268 #if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) 271 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
272 , id_(shared_count_id)
276 typedef typename A::template rebind< impl_type >::other A2;
280 #ifndef BOOST_NO_EXCEPTIONS 284 pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
285 new(
static_cast< void*
>( pi_ ) ) impl_type( p, a );
293 a2.deallocate( static_cast< impl_type* >( pi_ ), 1 );
301 pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
305 new(
static_cast< void*
>( pi_ ) ) impl_type( p, a );
313 #endif // #ifndef BOOST_NO_EXCEPTIONS 316 #endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) 318 #ifndef BOOST_NO_AUTO_PTR 324 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
325 , id_(shared_count_id)
328 #ifdef BOOST_NO_EXCEPTIONS 342 #if !defined( BOOST_NO_CXX11_SMART_PTR ) 344 template<
class Y,
class D>
346 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
347 , id_(shared_count_id)
352 D2 d2( r.get_deleter() );
355 #ifdef BOOST_NO_EXCEPTIONS 372 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 378 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
379 , id_(shared_count_id)
385 #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) 388 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
389 , id_(shared_count_id)
428 return use_count() == 1;
438 return a.pi_ == b.pi_;
443 return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
464 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 473 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
480 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
488 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
497 #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) 500 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
512 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 564 return a.pi_ == b.pi_;
569 return std::less<sp_counted_base *>()(a.pi_, b.pi_);
574 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
575 , id_(shared_count_id)
585 #
if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
586 , id_(shared_count_id)
600 # pragma warn .8027 // Functions containing try are not expanded inline 603 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED void checked_delete(T *x)
void * get_deleter(sp_typeinfo const &ti) const
shared_count(shared_count const &r)
shared_count(std::unique_ptr< Y, D > &r)
friend bool operator<(shared_count const &a, shared_count const &b)
shared_count(P p, sp_inplace_tag< D >, A a)
virtual void * get_untyped_deleter()=0
sp_reference_wrapper(T &t)
shared_count(std::auto_ptr< Y > &r)
void operator()(Y *p) const
friend bool operator<(weak_count const &a, weak_count const &b)
weak_count(shared_count const &r)
sp_reference_wrapper< D > type
shared_count(P p, sp_inplace_tag< D >)
void * get_untyped_deleter() const
weak_count(weak_count const &r)
weak_count(weak_count &&r)
void swap(shared_count &r)
friend bool operator==(weak_count const &a, weak_count const &b)
friend bool operator==(shared_count const &a, shared_count const &b)
shared_count(P p, D d, A a)
std::type_info sp_typeinfo
virtual void * get_deleter(sp_typeinfo const &ti)=0
shared_count(shared_count &&r)
BOOST_ATTRIBUTE_NORETURN void throw_exception(E const &e)