Enable move-only deleters

This commit is contained in:
Peter Dimov committed 2021-05-11 01:59:01 +03:00
1 parent d751041fb9
commit 594c7485a5
5 files changed
+136 -5

No files matched your search

@@ -388,7 +388,7 @@ public:
typedef typename sp_convert_reference<D>::type D2;
D2 d2( static_cast<D&&>( r.get_deleter() ) );
pi_ = new sp_counted_impl_pd< typename std::unique_ptr<Y, D>::pointer, D2 >( r.get(), static_cast< D2&& >( d2 ) );
pi_ = new sp_counted_impl_pd< typename std::unique_ptr<Y, D>::pointer, D2 >( r.get(), d2 );
#ifdef BOOST_NO_EXCEPTIONS
@@ -156,13 +156,15 @@ public:
// pre: d(p) must not throw
sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d )
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
sp_counted_impl_pd( P p, D & d ): ptr( p ), del( static_cast< D&& >( d ) )
{
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
#else
sp_counted_impl_pd( P p, D && d ): ptr( p ), del( static_cast< D&& >( d ) )
sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d )
{
}
+23 -1
View File
@@ -374,16 +374,27 @@ public:
}
//
// Requirements: D's copy constructor must not throw
// Requirements: D's copy/move constructors must not throw
//
// shared_ptr will release p by calling d(p)
//
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y, class D> shared_ptr( Y * p, D d ): px( p ), pn( p, static_cast< D&& >( d ) )
{
boost::detail::sp_deleter_construct( this, p );
}
#else
template<class Y, class D> shared_ptr( Y * p, D d ): px( p ), pn( p, d )
{
boost::detail::sp_deleter_construct( this, p );
}
#endif
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d )
@@ -693,11 +704,22 @@ public:
this_type( p ).swap( *this );
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y, class D> void reset( Y * p, D d )
{
this_type( p, static_cast< D&& >( d ) ).swap( *this );
}
#else
template<class Y, class D> void reset( Y * p, D d )
{
this_type( p, d ).swap( *this );
}
#endif
template<class Y, class D, class A> void reset( Y * p, D d, A a )
{
this_type( p, d, a ).swap( *this );