Enable move-only deleters in the allocator constructor

This commit is contained in:
Peter Dimov
2021-05-11 02:05:28 +03:00
parent 594c7485a5
commit b52d7548b3
3 changed files with 54 additions and 3 deletions
+18 -2
View File
@@ -405,11 +405,22 @@ public:
// As above, but with allocator. A's copy constructor shall not throw.
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a )
{
boost::detail::sp_deleter_construct( this, p );
}
#else
template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
{
boost::detail::sp_deleter_construct( this, p );
}
#endif
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
@@ -711,6 +722,11 @@ public:
this_type( p, static_cast< D&& >( d ) ).swap( *this );
}
template<class Y, class D, class A> void reset( Y * p, D d, A a )
{
this_type( p, static_cast< D&& >( d ), a ).swap( *this );
}
#else
template<class Y, class D> void reset( Y * p, D d )
@@ -718,13 +734,13 @@ public:
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 );
}
#endif
template<class Y> void reset( shared_ptr<Y> const & r, element_type * p ) BOOST_SP_NOEXCEPT
{
this_type( r, p ).swap( *this );