Remove uses of BOOST_NO_CXX11_RVALUE_REFERENCES

This commit is contained in:
Peter Dimov
2024-09-24 22:51:38 +03:00
parent cd0b99380e
commit ce308f21e8
24 changed files with 3 additions and 440 deletions
-119
View File
@@ -290,14 +290,10 @@ public:
{
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count && pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( std::move( pn_ ) )
{
}
#endif
template<class Y>
explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete
{
@@ -310,80 +306,33 @@ public:
// 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_RVALUE_REFERENCES )
template<class D> shared_ptr( std::nullptr_t p, D d ): px( p ), pn( p, static_cast< D&& >( d ) )
{
}
#else
template<class D> shared_ptr( std::nullptr_t p, D d ): px( p ), pn( p, d )
{
}
#endif
// 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_RVALUE_REFERENCES )
template<class D, class A> shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a )
{
}
#else
template<class D, class A> shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
{
}
#endif
// generated copy constructor, destructor are fine...
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
// ... except in C++0x, move disables the implicit copy
shared_ptr( shared_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn )
{
}
#endif
template<class Y>
explicit shared_ptr( weak_ptr<Y> const & r ): pn( r.pn ) // may throw
{
@@ -429,8 +378,6 @@ public:
boost::detail::sp_deleter_construct( this, tmp );
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y>
shared_ptr( std::auto_ptr<Y> && r ): px(r.get()), pn()
{
@@ -442,27 +389,8 @@ public:
boost::detail::sp_deleter_construct( this, tmp );
}
#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
template<class Ap>
explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn()
{
typedef typename Ap::element_type Y;
boost::detail::sp_assert_convertible< Y, T >();
Y * tmp = r.get();
pn = boost::detail::shared_count( r );
boost::detail::sp_deleter_construct( this, tmp );
}
#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#endif // BOOST_NO_AUTO_PTR
#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template< class Y, class D >
shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn()
{
@@ -477,8 +405,6 @@ public:
}
}
#endif
template< class Y, class D >
shared_ptr( boost::movelib::unique_ptr< Y, D > r ): px( r.get() ), pn()
{
@@ -517,8 +443,6 @@ public:
return *this;
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y>
shared_ptr & operator=( std::auto_ptr<Y> && r )
{
@@ -526,21 +450,8 @@ public:
return *this;
}
#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
template<class Ap>
typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
{
this_type( r ).swap( *this );
return *this;
}
#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#endif // BOOST_NO_AUTO_PTR
#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y, class D>
shared_ptr & operator=( std::unique_ptr<Y, D> && r )
{
@@ -548,8 +459,6 @@ public:
return *this;
}
#endif
template<class Y, class D>
shared_ptr & operator=( boost::movelib::unique_ptr<Y, D> r )
{
@@ -576,8 +485,6 @@ public:
// Move support
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
shared_ptr( shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::shared_count && >( r.pn ) )
{
r.px = 0;
@@ -612,8 +519,6 @@ public:
r.px = 0;
}
#endif
shared_ptr & operator=( std::nullptr_t ) BOOST_SP_NOEXCEPT
{
this_type().swap(*this);
@@ -631,8 +536,6 @@ 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 );
@@ -643,34 +546,16 @@ public:
this_type( p, static_cast< D&& >( d ), a ).swap( *this );
}
#else
template<class Y, class D> void reset( Y * p, D d )
{
this_type( p, d ).swap( *this );
}
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 );
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y> void reset( shared_ptr<Y> && r, element_type * p ) BOOST_SP_NOEXCEPT
{
this_type( static_cast< shared_ptr<Y> && >( r ), p ).swap( *this );
}
#endif
typename boost::detail::sp_dereference< T >::type operator* () const BOOST_SP_NOEXCEPT_WITH_ASSERT
{
BOOST_ASSERT( px != 0 );
@@ -856,8 +741,6 @@ template<class T, class U> shared_ptr<T> reinterpret_pointer_cast( shared_ptr<U>
return shared_ptr<T>( r, p );
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class T, class U> shared_ptr<T> static_pointer_cast( shared_ptr<U> && r ) BOOST_SP_NOEXCEPT
{
(void) static_cast< T* >( static_cast< U* >( 0 ) );
@@ -898,8 +781,6 @@ template<class T, class U> shared_ptr<T> reinterpret_pointer_cast( shared_ptr<U>
return shared_ptr<T>( std::move(r), p );
}
#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
// get_pointer() enables boost::mem_fn to recognize shared_ptr
template<class T> inline typename shared_ptr<T>::element_type * get_pointer(shared_ptr<T> const & p) BOOST_SP_NOEXCEPT