From bd0419c29036c3f0e14dcef135ff1d1e2d4f1e0b Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 24 Sep 2024 18:49:22 +0300 Subject: [PATCH] Remove uses of BOOST_SP_NO_SP_CONVERTIBLE --- .../boost/smart_ptr/detail/sp_convertible.hpp | 12 --------- include/boost/smart_ptr/intrusive_ptr.hpp | 16 ------------ include/boost/smart_ptr/local_shared_ptr.hpp | 4 +-- include/boost/smart_ptr/shared_array.hpp | 8 ------ include/boost/smart_ptr/shared_ptr.hpp | 25 ------------------- include/boost/smart_ptr/weak_ptr.hpp | 24 ------------------ test/lsp_convertible_test.cpp | 4 --- test/lsp_convertible_test2.cpp | 2 +- test/sp_convertible_test.cpp | 4 --- test/sp_convertible_test2.cpp | 4 --- 10 files changed, 3 insertions(+), 100 deletions(-) diff --git a/include/boost/smart_ptr/detail/sp_convertible.hpp b/include/boost/smart_ptr/detail/sp_convertible.hpp index eff46d2..c60f69f 100644 --- a/include/boost/smart_ptr/detail/sp_convertible.hpp +++ b/include/boost/smart_ptr/detail/sp_convertible.hpp @@ -18,16 +18,6 @@ #include #include -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - namespace boost { @@ -83,6 +73,4 @@ template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_i } // namespace boost -#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED diff --git a/include/boost/smart_ptr/intrusive_ptr.hpp b/include/boost/smart_ptr/intrusive_ptr.hpp index 138eee6..fa260ba 100644 --- a/include/boost/smart_ptr/intrusive_ptr.hpp +++ b/include/boost/smart_ptr/intrusive_ptr.hpp @@ -61,15 +61,7 @@ public: } template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - intrusive_ptr( intrusive_ptr const & rhs, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - intrusive_ptr( intrusive_ptr const & rhs ) - -#endif : px( rhs.get() ) { if( px != 0 ) intrusive_ptr_add_ref( px ); @@ -109,15 +101,7 @@ public: template friend class intrusive_ptr; template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - intrusive_ptr(intrusive_ptr && rhs, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty()) - -#else - - intrusive_ptr(intrusive_ptr && rhs) - -#endif : px( rhs.px ) { rhs.px = 0; diff --git a/include/boost/smart_ptr/local_shared_ptr.hpp b/include/boost/smart_ptr/local_shared_ptr.hpp index 54cd6fa..b7a8043 100644 --- a/include/boost/smart_ptr/local_shared_ptr.hpp +++ b/include/boost/smart_ptr/local_shared_ptr.hpp @@ -444,7 +444,7 @@ public: // conversions to shared_ptr, weak_ptr -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) +#if !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) template::type> operator shared_ptr() const BOOST_SP_NOEXCEPT #else template operator shared_ptr() const BOOST_SP_NOEXCEPT @@ -462,7 +462,7 @@ public: } } -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) +#if !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) template::type> operator weak_ptr() const BOOST_SP_NOEXCEPT #else template operator weak_ptr() const BOOST_SP_NOEXCEPT diff --git a/include/boost/smart_ptr/shared_array.hpp b/include/boost/smart_ptr/shared_array.hpp index 284a75c..221119a 100644 --- a/include/boost/smart_ptr/shared_array.hpp +++ b/include/boost/smart_ptr/shared_array.hpp @@ -111,15 +111,7 @@ public: // conversion template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - shared_array( shared_array const & r, typename boost::detail::sp_enable_if_convertible< Y[], T[] >::type = boost::detail::sp_empty() ) - -#else - - shared_array( shared_array const & r ) - -#endif BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) { boost::detail::sp_assert_convertible< Y[], T[] >(); diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp index 22b2d28..5ab1b0e 100644 --- a/include/boost/smart_ptr/shared_ptr.hpp +++ b/include/boost/smart_ptr/shared_ptr.hpp @@ -211,18 +211,9 @@ template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R template< class Y, class T > inline void sp_assert_convertible() BOOST_SP_NOEXCEPT { -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - // static_assert( sp_convertible< Y, T >::value ); typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; (void)sizeof( tmp ); - -#else - - T* p = static_cast< Y* >( 0 ); - (void)p; - -#endif } // pointer constructor helper @@ -426,15 +417,7 @@ public: } template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - shared_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr const & r ) - -#endif BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) { boost::detail::sp_assert_convertible< Y, T >(); @@ -614,15 +597,7 @@ public: } template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - shared_ptr( shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr && r ) - -#endif BOOST_SP_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::shared_count && >( r.pn ) ) { boost::detail::sp_assert_convertible< Y, T >(); diff --git a/include/boost/smart_ptr/weak_ptr.hpp b/include/boost/smart_ptr/weak_ptr.hpp index 655a38b..6cafab3 100644 --- a/include/boost/smart_ptr/weak_ptr.hpp +++ b/include/boost/smart_ptr/weak_ptr.hpp @@ -74,15 +74,7 @@ public: // template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - weak_ptr( weak_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - weak_ptr( weak_ptr const & r ) - -#endif BOOST_SP_NOEXCEPT : px(r.lock().get()), pn(r.pn) { boost::detail::sp_assert_convertible< Y, T >(); @@ -91,15 +83,7 @@ public: #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - weak_ptr( weak_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - weak_ptr( weak_ptr && r ) - -#endif BOOST_SP_NOEXCEPT : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) { boost::detail::sp_assert_convertible< Y, T >(); @@ -124,15 +108,7 @@ public: #endif template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - weak_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - weak_ptr( shared_ptr const & r ) - -#endif BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) { boost::detail::sp_assert_convertible< Y, T >(); diff --git a/test/lsp_convertible_test.cpp b/test/lsp_convertible_test.cpp index 4f5017a..67722df 100644 --- a/test/lsp_convertible_test.cpp +++ b/test/lsp_convertible_test.cpp @@ -78,8 +78,6 @@ using boost::weak_ptr; int main() { -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - TEST_CV_TRUE( X, X ) TEST_CV_TRUE( X, void ) TEST_CV_FALSE( void, X ) @@ -102,7 +100,5 @@ int main() TEST_CV_TRUE( X[3], void ) TEST_CV_FALSE( void, X[3] ) -#endif - return boost::report_errors(); } diff --git a/test/lsp_convertible_test2.cpp b/test/lsp_convertible_test2.cpp index 2104b4e..a946e53 100644 --- a/test/lsp_convertible_test2.cpp +++ b/test/lsp_convertible_test2.cpp @@ -78,7 +78,7 @@ using boost::weak_ptr; int main() { -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) +#if !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) TEST_CV_TRUE( X, X ) TEST_CV_TRUE( X, void ) diff --git a/test/sp_convertible_test.cpp b/test/sp_convertible_test.cpp index d06af75..65cc2e4 100644 --- a/test/sp_convertible_test.cpp +++ b/test/sp_convertible_test.cpp @@ -61,8 +61,6 @@ class D: public B int main() { -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - using boost::detail::sp_convertible; TEST_CV_TRUE( X, X ) @@ -87,7 +85,5 @@ int main() TEST_CV_TRUE( X[3], void ) TEST_CV_FALSE( void, X[3] ) -#endif - return boost::report_errors(); } diff --git a/test/sp_convertible_test2.cpp b/test/sp_convertible_test2.cpp index 7635d82..5b8272f 100644 --- a/test/sp_convertible_test2.cpp +++ b/test/sp_convertible_test2.cpp @@ -78,8 +78,6 @@ using boost::weak_ptr; int main() { -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - TEST_CV_TRUE( X, X ) TEST_CV_TRUE( X, void ) TEST_CV_FALSE( void, X ) @@ -102,7 +100,5 @@ int main() TEST_CV_TRUE( X[3], void ) TEST_CV_FALSE( void, X[3] ) -#endif - return boost::report_errors(); }