diff options
Diffstat (limited to 'boost/smart_ptr/detail/sp_counted_impl.hpp')
-rw-r--r-- | boost/smart_ptr/detail/sp_counted_impl.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/boost/smart_ptr/detail/sp_counted_impl.hpp b/boost/smart_ptr/detail/sp_counted_impl.hpp index b29769e3af..fa2f75eb1a 100644 --- a/boost/smart_ptr/detail/sp_counted_impl.hpp +++ b/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -26,6 +26,7 @@ #include <boost/checked_delete.hpp> #include <boost/smart_ptr/detail/sp_counted_base.hpp> +#include <boost/core/addressof.hpp> #if defined(BOOST_SP_USE_QUICK_ALLOCATOR) #include <boost/smart_ptr/detail/quick_allocator.hpp> @@ -50,6 +51,19 @@ void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn ); namespace detail { +// get_local_deleter + +template<class D> class local_sp_deleter; + +template<class D> D * get_local_deleter( D * /*p*/ ) +{ + return 0; +} + +template<class D> D * get_local_deleter( local_sp_deleter<D> * p ); + +// + template<class X> class sp_counted_impl_p: public sp_counted_base { private: @@ -83,6 +97,11 @@ public: return 0; } + virtual void * get_local_deleter( sp_typeinfo const & ) + { + return 0; + } + virtual void * get_untyped_deleter() { return 0; @@ -158,6 +177,11 @@ public: return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0; } + virtual void * get_local_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; + } + virtual void * get_untyped_deleter() { return &reinterpret_cast<char&>( del ); @@ -246,6 +270,11 @@ public: return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0; } + virtual void * get_local_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; + } + virtual void * get_untyped_deleter() { return &reinterpret_cast<char&>( d_ ); |