From ce308f21e88ee8c0773eae9681934d12aa0f4bf3 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 24 Sep 2024 22:51:38 +0300 Subject: [PATCH] Remove uses of BOOST_NO_CXX11_RVALUE_REFERENCES --- include/boost/smart_ptr/atomic_shared_ptr.hpp | 24 ---- .../smart_ptr/detail/local_counted_base.hpp | 4 - .../smart_ptr/detail/local_sp_deleter.hpp | 4 - .../boost/smart_ptr/detail/shared_count.hpp | 8 -- .../smart_ptr/detail/sp_counted_impl.hpp | 20 --- include/boost/smart_ptr/intrusive_ptr.hpp | 8 -- include/boost/smart_ptr/local_shared_ptr.hpp | 36 ------ include/boost/smart_ptr/shared_array.hpp | 9 -- include/boost/smart_ptr/shared_ptr.hpp | 119 ------------------ include/boost/smart_ptr/weak_ptr.hpp | 17 --- test/intrusive_ptr_move_test.cpp | 11 -- test/local_sp_test.cpp | 60 --------- test/lsp_array_test.cpp | 4 - test/make_shared_move_emulation_test.cpp | 2 - test/make_shared_perfect_forwarding_test.cpp | 11 -- test/shared_ptr_alias_move_test.cpp | 17 +-- test/shared_ptr_move_test.cpp | 11 -- test/shared_ptr_rv_pointer_cast_test.cpp | 11 -- test/sp_array_test.cpp | 4 - test/sp_move_only_deleter.cpp | 9 -- test/sp_unique_ptr_test.cpp | 11 -- test/sp_unique_ptr_test2.cpp | 19 --- test/weak_ptr_alias_move_test.cpp | 13 +- test/weak_ptr_move_test.cpp | 11 -- 24 files changed, 3 insertions(+), 440 deletions(-) diff --git a/include/boost/smart_ptr/atomic_shared_ptr.hpp b/include/boost/smart_ptr/atomic_shared_ptr.hpp index b863100..b185ca4 100644 --- a/include/boost/smart_ptr/atomic_shared_ptr.hpp +++ b/include/boost/smart_ptr/atomic_shared_ptr.hpp @@ -77,11 +77,7 @@ public: } atomic_shared_ptr( shared_ptr p ) BOOST_SP_NOEXCEPT -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) : p_( std::move( p ) ) -#else - : p_( p ) -#endif { boost::detail::spinlock init = BOOST_DETAIL_SPINLOCK_INIT; std::memcpy( &l_, &init, sizeof( init ) ); @@ -139,15 +135,7 @@ public: p_.swap( r ); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - return std::move( r ); - -#else - - return r; - -#endif } template shared_ptr exchange( shared_ptr r, M ) BOOST_SP_NOEXCEPT @@ -157,15 +145,7 @@ public: p_.swap( r ); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - return std::move( r ); - -#else - - return r; - -#endif } template bool compare_exchange_weak( shared_ptr& v, const shared_ptr& w, M, M ) BOOST_SP_NOEXCEPT @@ -198,8 +178,6 @@ public: return compare_exchange( v, w ); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template bool compare_exchange_weak( shared_ptr& v, shared_ptr&& w, M, M ) BOOST_SP_NOEXCEPT { return compare_exchange( v, std::move( w ) ); @@ -229,8 +207,6 @@ public: { return compare_exchange( v, std::move( w ) ); } - -#endif }; } // namespace boost diff --git a/include/boost/smart_ptr/detail/local_counted_base.hpp b/include/boost/smart_ptr/detail/local_counted_base.hpp index f730419..c3b352a 100644 --- a/include/boost/smart_ptr/detail/local_counted_base.hpp +++ b/include/boost/smart_ptr/detail/local_counted_base.hpp @@ -105,14 +105,10 @@ public: { } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - explicit local_counted_impl( shared_count && pn ) BOOST_SP_NOEXCEPT: pn_( std::move(pn) ) { } -#endif - void local_cb_destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { delete this; diff --git a/include/boost/smart_ptr/detail/local_sp_deleter.hpp b/include/boost/smart_ptr/detail/local_sp_deleter.hpp index bceb568..84f373b 100644 --- a/include/boost/smart_ptr/detail/local_sp_deleter.hpp +++ b/include/boost/smart_ptr/detail/local_sp_deleter.hpp @@ -42,14 +42,10 @@ public: { } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - explicit local_sp_deleter( D&& d ) BOOST_SP_NOEXCEPT: d_( std::move(d) ) { } -#endif - D& deleter() BOOST_SP_NOEXCEPT { return d_; diff --git a/include/boost/smart_ptr/detail/shared_count.hpp b/include/boost/smart_ptr/detail/shared_count.hpp index 17c6a96..2e80e85 100644 --- a/include/boost/smart_ptr/detail/shared_count.hpp +++ b/include/boost/smart_ptr/detail/shared_count.hpp @@ -424,8 +424,6 @@ public: if( pi_ != 0 ) pi_->add_ref_copy(); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - shared_count(shared_count && r) BOOST_SP_NOEXCEPT: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) @@ -434,8 +432,6 @@ public: r.pi_ = 0; } -#endif - explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_SP_NOEXCEPT; // constructs an empty *this when r.use_count() == 0 @@ -550,8 +546,6 @@ public: // Move support -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - weak_count(weak_count && r) BOOST_SP_NOEXCEPT: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) @@ -560,8 +554,6 @@ public: r.pi_ = 0; } -#endif - ~weak_count() /*BOOST_SP_NOEXCEPT*/ { if(pi_ != 0) pi_->weak_release(); diff --git a/include/boost/smart_ptr/detail/sp_counted_impl.hpp b/include/boost/smart_ptr/detail/sp_counted_impl.hpp index 231a0c2..3c3d9f0 100644 --- a/include/boost/smart_ptr/detail/sp_counted_impl.hpp +++ b/include/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -149,20 +149,10 @@ public: // pre: d(p) must not throw -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - sp_counted_impl_pd( P p, D & d ): ptr( p ), del( static_cast< D&& >( d ) ) { } -#else - - sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) - { - } - -#endif - sp_counted_impl_pd( P p ): ptr( p ), del() { } @@ -233,20 +223,10 @@ public: // pre: d( p ) must not throw -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( static_cast< D&& >( d ) ), a_( a ) { } -#else - - sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) - { - } - -#endif - sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a ) { } diff --git a/include/boost/smart_ptr/intrusive_ptr.hpp b/include/boost/smart_ptr/intrusive_ptr.hpp index f2daf91..3559f2e 100644 --- a/include/boost/smart_ptr/intrusive_ptr.hpp +++ b/include/boost/smart_ptr/intrusive_ptr.hpp @@ -85,8 +85,6 @@ public: // Move support -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - intrusive_ptr(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT : px( rhs.px ) { rhs.px = 0; @@ -114,8 +112,6 @@ public: return *this; } -#endif - intrusive_ptr & operator=(intrusive_ptr const & rhs) { this_type(rhs).swap(*this); @@ -266,8 +262,6 @@ template intrusive_ptr dynamic_pointer_cast(intrusive_ptr(p.get()); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template intrusive_ptr static_pointer_cast( intrusive_ptr && p ) BOOST_SP_NOEXCEPT { return intrusive_ptr( static_cast( p.detach() ), false ); @@ -289,8 +283,6 @@ template intrusive_ptr dynamic_pointer_cast( intrusive_ptr< return r; } -#endif // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - // operator<< template std::ostream & operator<< (std::ostream & os, intrusive_ptr const & p) diff --git a/include/boost/smart_ptr/local_shared_ptr.hpp b/include/boost/smart_ptr/local_shared_ptr.hpp index 6c12257..cc610b3 100644 --- a/include/boost/smart_ptr/local_shared_ptr.hpp +++ b/include/boost/smart_ptr/local_shared_ptr.hpp @@ -189,8 +189,6 @@ public: } } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template local_shared_ptr( shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) : px( r.get() ), pn( 0 ) @@ -204,12 +202,8 @@ public: } } -#endif - // construction from unique_ptr -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template< class Y, class D > local_shared_ptr( std::unique_ptr< Y, D > && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) @@ -223,8 +217,6 @@ public: } } -#endif - template< class Y, class D > local_shared_ptr( boost::movelib::unique_ptr< Y, D > r ); // ! // : px( r.get() ), pn( new boost::detail::local_counted_impl( shared_ptr( std::move(r) ) ) ) @@ -244,16 +236,12 @@ public: // move constructor -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - local_shared_ptr( local_shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) { r.px = 0; r.pn = 0; } -#endif - // converting copy constructor template local_shared_ptr( local_shared_ptr const & r, @@ -270,8 +258,6 @@ public: // converting move constructor -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template local_shared_ptr( local_shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) @@ -282,8 +268,6 @@ public: r.pn = 0; } -#endif - // aliasing template @@ -295,8 +279,6 @@ public: } } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template local_shared_ptr( local_shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) { @@ -304,8 +286,6 @@ public: r.pn = 0; } -#endif - // assignment local_shared_ptr & operator=( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT @@ -320,8 +300,6 @@ public: return *this; } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - local_shared_ptr & operator=( local_shared_ptr && r ) BOOST_SP_NOEXCEPT { local_shared_ptr( std::move( r ) ).swap( *this ); @@ -335,16 +313,12 @@ public: return *this; } -#endif - local_shared_ptr & operator=( std::nullptr_t ) BOOST_SP_NOEXCEPT { local_shared_ptr().swap(*this); return *this; } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template local_shared_ptr & operator=( std::unique_ptr && r ) { @@ -352,8 +326,6 @@ public: return *this; } -#endif - template local_shared_ptr & operator=( boost::movelib::unique_ptr r ); // ! @@ -384,15 +356,11 @@ public: local_shared_ptr( r, p ).swap( *this ); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template void reset( local_shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT { local_shared_ptr( std::move( r ), p ).swap( *this ); } -#endif - // accessors typename boost::detail::sp_dereference< T >::type operator* () const BOOST_SP_NOEXCEPT @@ -587,8 +555,6 @@ template local_shared_ptr reinterpret_pointer_cast( local_s return local_shared_ptr( r, p ); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template local_shared_ptr static_pointer_cast( local_shared_ptr && r ) BOOST_SP_NOEXCEPT { (void) static_cast< T* >( static_cast< U* >( 0 ) ); @@ -629,8 +595,6 @@ template local_shared_ptr reinterpret_pointer_cast( local_s return local_shared_ptr( std::move(r), p ); } -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - // get_pointer() enables boost::mem_fn to recognize local_shared_ptr template inline typename local_shared_ptr::element_type * get_pointer( local_shared_ptr const & p ) BOOST_SP_NOEXCEPT diff --git a/include/boost/smart_ptr/shared_array.hpp b/include/boost/smart_ptr/shared_array.hpp index e032983..2c28fad 100644 --- a/include/boost/smart_ptr/shared_array.hpp +++ b/include/boost/smart_ptr/shared_array.hpp @@ -82,9 +82,6 @@ public: } // generated copy constructor, destructor are fine... - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - // ... except in C++0x, move disables the implicit copy shared_array( shared_array const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) @@ -97,8 +94,6 @@ public: r.px = 0; } -#endif - // conversion template @@ -130,8 +125,6 @@ public: return *this; } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - shared_array & operator=( shared_array && r ) BOOST_SP_NOEXCEPT { this_type( static_cast< shared_array && >( r ) ).swap( *this ); @@ -145,8 +138,6 @@ public: return *this; } -#endif - void reset() BOOST_SP_NOEXCEPT { this_type().swap( *this ); diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp index cec0930..278445d 100644 --- a/include/boost/smart_ptr/shared_ptr.hpp +++ b/include/boost/smart_ptr/shared_ptr.hpp @@ -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 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 shared_ptr( Y * p, D d ): px( p ), pn( p, static_cast< D&& >( d ) ) { boost::detail::sp_deleter_construct( this, p ); } -#else - - template 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 shared_ptr( std::nullptr_t p, D d ): px( p ), pn( p, static_cast< D&& >( d ) ) { } -#else - - template 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 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 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 shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a ) { } -#else - - template 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 explicit shared_ptr( weak_ptr 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 shared_ptr( std::auto_ptr && 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 - explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr::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 shared_ptr & operator=( std::auto_ptr && r ) { @@ -526,21 +450,8 @@ public: return *this; } -#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - - template - 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 shared_ptr & operator=( std::unique_ptr && r ) { @@ -548,8 +459,6 @@ public: return *this; } -#endif - template shared_ptr & operator=( boost::movelib::unique_ptr 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 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 void reset( Y * p, D d ) - { - this_type( p, d ).swap( *this ); - } - - template void reset( Y * p, D d, A a ) - { - this_type( p, d, a ).swap( *this ); - } - -#endif - template void reset( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT { this_type( r, p ).swap( *this ); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template void reset( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT { this_type( static_cast< shared_ptr && >( 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 shared_ptr reinterpret_pointer_cast( shared_ptr return shared_ptr( r, p ); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template shared_ptr static_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT { (void) static_cast< T* >( static_cast< U* >( 0 ) ); @@ -898,8 +781,6 @@ template shared_ptr reinterpret_pointer_cast( shared_ptr return shared_ptr( std::move(r), p ); } -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - // get_pointer() enables boost::mem_fn to recognize shared_ptr template inline typename shared_ptr::element_type * get_pointer(shared_ptr const & p) BOOST_SP_NOEXCEPT diff --git a/include/boost/smart_ptr/weak_ptr.hpp b/include/boost/smart_ptr/weak_ptr.hpp index 6cafab3..5b393b4 100644 --- a/include/boost/smart_ptr/weak_ptr.hpp +++ b/include/boost/smart_ptr/weak_ptr.hpp @@ -38,9 +38,6 @@ public: } // generated copy constructor, assignment, destructor are fine... - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - // ... except in C++0x, move disables the implicit copy weak_ptr( weak_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) @@ -54,8 +51,6 @@ public: return *this; } -#endif - // // The "obvious" converting constructor implementation: // @@ -80,8 +75,6 @@ public: boost::detail::sp_assert_convertible< Y, T >(); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template weak_ptr( weak_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) BOOST_SP_NOEXCEPT : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) @@ -105,8 +98,6 @@ public: } -#endif - template weak_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) @@ -123,14 +114,10 @@ public: { } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template weak_ptr(weak_ptr && r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( std::move( r.pn ) ) { } -#endif - template weak_ptr & operator=( weak_ptr const & r ) BOOST_SP_NOEXCEPT { @@ -142,8 +129,6 @@ public: return *this; } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template weak_ptr & operator=( weak_ptr && r ) BOOST_SP_NOEXCEPT { @@ -151,8 +136,6 @@ public: return *this; } -#endif - template weak_ptr & operator=( shared_ptr const & r ) BOOST_SP_NOEXCEPT { diff --git a/test/intrusive_ptr_move_test.cpp b/test/intrusive_ptr_move_test.cpp index 1a23bd0..c894b51 100644 --- a/test/intrusive_ptr_move_test.cpp +++ b/test/intrusive_ptr_move_test.cpp @@ -14,8 +14,6 @@ #include #include -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - namespace N { @@ -245,12 +243,3 @@ int main() return boost::report_errors(); } - -#else // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#endif diff --git a/test/local_sp_test.cpp b/test/local_sp_test.cpp index 4d35c50..abbf231 100644 --- a/test/local_sp_test.cpp +++ b/test/local_sp_test.cpp @@ -407,8 +407,6 @@ static void copy_constructor() // move constructor -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template static void empty_move_test() { boost::local_shared_ptr p2(( boost::local_shared_ptr() )); @@ -489,14 +487,6 @@ static void move_constructor() BOOST_TEST( X::instances == 0 ); } -#else - -static void move_constructor() -{ -} - -#endif - // aliasing constructor template void test_aliasing_( boost::local_shared_ptr const & p1, U * p2 ) @@ -720,8 +710,6 @@ static void shared_ptr_copy_constructor() // shared_ptr_move constructor -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template static void empty_shared_ptr_move_test() { boost::local_shared_ptr p2(( boost::shared_ptr() )); @@ -801,18 +789,8 @@ static void shared_ptr_move_constructor() BOOST_TEST( X::instances == 0 ); } -#else - -static void shared_ptr_move_constructor() -{ -} - -#endif - // unique_ptr_constructor -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template static void test_null_unique_ptr( std::unique_ptr && p1 ) { boost::local_shared_ptr p2( std::move( p1 ) ); @@ -914,14 +892,6 @@ static void unique_ptr_constructor() deleter_unique_ptr_test(); } -#else - -static void unique_ptr_constructor() -{ -} - -#endif - // copy assignment template static void empty_copy_assign_test() @@ -1079,8 +1049,6 @@ static void copy_assignment() // move assignment -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template static void empty_move_assign_test() { boost::local_shared_ptr p2; @@ -1219,14 +1187,6 @@ static void move_assignment() BOOST_TEST( X::instances == 0 ); } -#else - -static void move_assignment() -{ -} - -#endif - // nullptr assignment template static void test_nullptr_assign( boost::local_shared_ptr p1 ) @@ -1494,8 +1454,6 @@ static void shared_ptr_copy_assignment() // shared_ptr_move assignment -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - template static void empty_shared_ptr_move_assign_test() { boost::local_shared_ptr p2; @@ -1639,18 +1597,8 @@ static void shared_ptr_move_assignment() BOOST_TEST( X::instances == 0 ); } -#else - -static void shared_ptr_move_assignment() -{ -} - -#endif - // unique_ptr assignment -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) && !defined( BOOST_NO_CXX11_SMART_PTR ) - template static void empty_unique_ptr_assign_test() { boost::local_shared_ptr p2; @@ -1791,14 +1739,6 @@ static void unique_ptr_assignment() BOOST_TEST( X::instances == 0 ); } -#else - -static void unique_ptr_assignment() -{ -} - -#endif - // pointer reset template static void test_pointer_reset( boost::local_shared_ptr p2 ) diff --git a/test/lsp_array_test.cpp b/test/lsp_array_test.cpp index eac0715..62c78cb 100644 --- a/test/lsp_array_test.cpp +++ b/test/lsp_array_test.cpp @@ -194,8 +194,6 @@ int main() BOOST_TEST( wp5.lock() == 0 ); } -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - { std::unique_ptr px( new X[ 4 ] ); BOOST_TEST( X::allocations == 1 ); @@ -255,8 +253,6 @@ int main() BOOST_TEST( X::instances == 0 ); } -#endif - { boost::local_shared_ptr px( new X[ 5 ], array_deleter< X >() ); BOOST_TEST( X::allocations == 1 ); diff --git a/test/make_shared_move_emulation_test.cpp b/test/make_shared_move_emulation_test.cpp index 48b98fc..829fe56 100644 --- a/test/make_shared_move_emulation_test.cpp +++ b/test/make_shared_move_emulation_test.cpp @@ -64,13 +64,11 @@ int main() boost::shared_ptr< ByRef > x = boost::make_shared< ByRef >(boost::move(a)); BOOST_TEST( x->constructed_by_ == ByRef::move_constructor); } -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) { boost::shared_ptr< ByVal > x = boost::make_shared< ByVal >(movearg()); boost::shared_ptr< ByRef > y = boost::make_shared< ByRef >(movearg()); BOOST_TEST( y->constructed_by_ == ByRef::move_constructor); } -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) { const movearg ca; boost::shared_ptr< ByRef > x = boost::make_shared< ByRef >(ca); diff --git a/test/make_shared_perfect_forwarding_test.cpp b/test/make_shared_perfect_forwarding_test.cpp index 06d5e00..a37f468 100644 --- a/test/make_shared_perfect_forwarding_test.cpp +++ b/test/make_shared_perfect_forwarding_test.cpp @@ -12,15 +12,6 @@ #include #include -#if defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#else // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - class myarg { public: @@ -94,5 +85,3 @@ int main() return boost::report_errors(); } - -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) diff --git a/test/shared_ptr_alias_move_test.cpp b/test/shared_ptr_alias_move_test.cpp index 9b670db..c1b1042 100644 --- a/test/shared_ptr_alias_move_test.cpp +++ b/test/shared_ptr_alias_move_test.cpp @@ -1,5 +1,3 @@ -#include - // shared_ptr_alias_move_test.cpp // // Copyright (c) 2007 Peter Dimov @@ -8,13 +6,11 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) - -#include #include +#include +#include #include -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - class incomplete; struct X @@ -244,12 +240,3 @@ int main() return boost::report_errors(); } - -#else // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#endif diff --git a/test/shared_ptr_move_test.cpp b/test/shared_ptr_move_test.cpp index 9e1f9e6..4ae4005 100644 --- a/test/shared_ptr_move_test.cpp +++ b/test/shared_ptr_move_test.cpp @@ -12,8 +12,6 @@ #include #include -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - struct X { static long instances; @@ -96,12 +94,3 @@ int main() return boost::report_errors(); } - -#else // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#endif diff --git a/test/shared_ptr_rv_pointer_cast_test.cpp b/test/shared_ptr_rv_pointer_cast_test.cpp index ddfaf73..35dd9b7 100644 --- a/test/shared_ptr_rv_pointer_cast_test.cpp +++ b/test/shared_ptr_rv_pointer_cast_test.cpp @@ -11,8 +11,6 @@ #include #include -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - struct X {}; @@ -95,12 +93,3 @@ int main() return boost::report_errors(); } - -#else // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) diff --git a/test/sp_array_test.cpp b/test/sp_array_test.cpp index 5cc68e3..ef06f31 100644 --- a/test/sp_array_test.cpp +++ b/test/sp_array_test.cpp @@ -194,8 +194,6 @@ int main() BOOST_TEST( wp5.lock() == 0 ); } -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - { std::unique_ptr px( new X[ 4 ] ); BOOST_TEST( X::allocations == 1 ); @@ -255,8 +253,6 @@ int main() BOOST_TEST( X::instances == 0 ); } -#endif - { boost::shared_ptr px( new X[ 5 ], array_deleter< X >() ); BOOST_TEST( X::allocations == 1 ); diff --git a/test/sp_move_only_deleter.cpp b/test/sp_move_only_deleter.cpp index 677cacc..992b32d 100644 --- a/test/sp_move_only_deleter.cpp +++ b/test/sp_move_only_deleter.cpp @@ -9,13 +9,6 @@ #include #include -#if defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_NO_CXX11_RVALUE_REFERENCES is defined") -int main() {} - -#else - struct Y { static int instances; @@ -145,5 +138,3 @@ int main() return boost::report_errors(); } - -#endif diff --git a/test/sp_unique_ptr_test.cpp b/test/sp_unique_ptr_test.cpp index 3bb2203..e759278 100644 --- a/test/sp_unique_ptr_test.cpp +++ b/test/sp_unique_ptr_test.cpp @@ -15,8 +15,6 @@ #include #include -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - struct X: public boost::enable_shared_from_this< X > { static int instances; @@ -283,12 +281,3 @@ int main() return boost::report_errors(); } - -#else // !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#endif diff --git a/test/sp_unique_ptr_test2.cpp b/test/sp_unique_ptr_test2.cpp index b1d6baf..a6641c7 100644 --- a/test/sp_unique_ptr_test2.cpp +++ b/test/sp_unique_ptr_test2.cpp @@ -9,23 +9,6 @@ #include #include -#if defined( BOOST_NO_CXX11_SMART_PTR ) - -BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_NO_CXX11_SMART_PTR is defined") -int main() {} - -#elif defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_NO_CXX11_RVALUE_REFERENCES is defined") -int main() {} - -#elif defined(BOOST_MSVC) && BOOST_MSVC < 1700 - -BOOST_PRAGMA_MESSAGE("Skipping test because msvc-10.0 unique_ptr doesn't support move-only deleters") -int main() {} - -#else - struct Y { static int instances; @@ -149,5 +132,3 @@ int main() return boost::report_errors(); } - -#endif diff --git a/test/weak_ptr_alias_move_test.cpp b/test/weak_ptr_alias_move_test.cpp index 57a7143..bc78bcd 100644 --- a/test/weak_ptr_alias_move_test.cpp +++ b/test/weak_ptr_alias_move_test.cpp @@ -8,15 +8,13 @@ // http://www.boost.org/LICENSE_1_0.txt) -#include #include #include +#include #include #include #include -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - class incomplete; struct X @@ -86,12 +84,3 @@ int main() return boost::report_errors(); } - -#else // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#endif diff --git a/test/weak_ptr_move_test.cpp b/test/weak_ptr_move_test.cpp index 9b3bf92..b3267e3 100644 --- a/test/weak_ptr_move_test.cpp +++ b/test/weak_ptr_move_test.cpp @@ -12,8 +12,6 @@ #include #include -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - struct X { static long instances; @@ -111,12 +109,3 @@ int main() return boost::report_errors(); } - -#else // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -int main() -{ - return 0; -} - -#endif