this_type; public: // pre: d(p) must not throw sp_counted_impl_pd( P p, D d ): ptr(p), del(d) { } virtual void dispose() // nothrow { del( ptr ); } virtual void * get_deleter( detail::sp_typeinfo const & ti ) { return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast( del ): 0; } #if defined(BOOST_SP_USE_STD_ALLOCATOR) void * operator new( std::size_t ) { return std::allocator().allocate( 1, static_cast(0) ); } void operator delete( void * p ) { std::allocator().deallocate( static_cast(p), 1 ); } #endif #if defined(BOOST_SP_USE_QUICK_ALLOCATOR) void * operator new( std::size_t ) { return quick_allocator::alloc(); } void operator delete( void * p ) { quick_allocator::dealloc( p ); } #endif }; template class sp_counted_impl_pda: public sp_counted_base { private: P p_; // copy constructor must not throw D d_; // copy constructor must not throw A a_; // copy constructor must not throw sp_counted_impl_pda( sp_counted_impl_pda const & ); sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); typedef sp_counted_impl_pda this_type; public: // pre: d( p ) must not throw sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a ) { } virtual void dispose() // nothrow { d_( p_ ); } virtual void destroy() // nothrow { typedef typename A::template rebind< this_type >::other A2; A2 a2( a_ ); this->~this_type(); a2.deallocate( this, 1 ); } virtual void * get_deleter( detail::sp_typeinfo const & ti ) { return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; } }; #ifdef __CODEGUARD__ # pragma option pop #endif } // namespace detail } // namespace boost #endif // #ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
this_type; public: // pre: d( p ) must not throw sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a ) { } virtual void dispose() // nothrow { d_( p_ ); } virtual void destroy() // nothrow { typedef typename A::template rebind< this_type >::other A2; A2 a2( a_ ); this->~this_type(); a2.deallocate( this, 1 ); } virtual void * get_deleter( detail::sp_typeinfo const & ti ) { return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; } }; #ifdef __CODEGUARD__ # pragma option pop #endif } // namespace detail } // namespace boost #endif // #ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED