From dbceed6210f71d9c62b80da7265dd650e46666df Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 2 Oct 2024 21:50:05 +0300 Subject: [PATCH] Remove uses of BOOST_SP_NOEXCEPT from shared_count.hpp --- .../boost/smart_ptr/detail/shared_count.hpp | 75 +++++++++---------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/include/boost/smart_ptr/detail/shared_count.hpp b/include/boost/smart_ptr/detail/shared_count.hpp index 1a79f48..36eb15b 100644 --- a/include/boost/smart_ptr/detail/shared_count.hpp +++ b/include/boost/smart_ptr/detail/shared_count.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -121,14 +120,14 @@ private: public: - BOOST_CONSTEXPR shared_count() BOOST_SP_NOEXCEPT: pi_(0) + BOOST_CONSTEXPR shared_count() noexcept: pi_(0) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif { } - BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ) BOOST_SP_NOEXCEPT: pi_( pi ) + BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ) noexcept: pi_( pi ) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -389,7 +388,7 @@ public: r.release(); } - ~shared_count() /*BOOST_SP_NOEXCEPT*/ + ~shared_count() /*noexcept*/ { if( pi_ != 0 ) pi_->release(); #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) @@ -397,7 +396,7 @@ public: #endif } - shared_count(shared_count const & r) BOOST_SP_NOEXCEPT: pi_(r.pi_) + shared_count(shared_count const & r) noexcept: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -405,7 +404,7 @@ public: if( pi_ != 0 ) pi_->add_ref_copy(); } - shared_count(shared_count && r) BOOST_SP_NOEXCEPT: pi_(r.pi_) + shared_count(shared_count && r) noexcept: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -414,9 +413,9 @@ public: } 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 + shared_count( weak_count const & r, sp_nothrow_tag ) noexcept; // constructs an empty *this when r.use_count() == 0 - shared_count & operator= (shared_count const & r) BOOST_SP_NOEXCEPT + shared_count & operator= (shared_count const & r) noexcept { sp_counted_base * tmp = r.pi_; @@ -430,58 +429,58 @@ public: return *this; } - void swap(shared_count & r) BOOST_SP_NOEXCEPT + void swap(shared_count & r) noexcept { sp_counted_base * tmp = r.pi_; r.pi_ = pi_; pi_ = tmp; } - long use_count() const BOOST_SP_NOEXCEPT + long use_count() const noexcept { return pi_ != 0? pi_->use_count(): 0; } - bool unique() const BOOST_SP_NOEXCEPT + bool unique() const noexcept { return use_count() == 1; } - bool empty() const BOOST_SP_NOEXCEPT + bool empty() const noexcept { return pi_ == 0; } - bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT + bool operator==( shared_count const & r ) const noexcept { return pi_ == r.pi_; } - bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT; + bool operator==( weak_count const & r ) const noexcept; - bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT + bool operator<( shared_count const & r ) const noexcept { return std::less()( pi_, r.pi_ ); } - bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT; + bool operator<( weak_count const & r ) const noexcept; - void * get_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT + void * get_deleter( sp_typeinfo_ const & ti ) const noexcept { return pi_? pi_->get_deleter( ti ): 0; } - void * get_local_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT + void * get_local_deleter( sp_typeinfo_ const & ti ) const noexcept { return pi_? pi_->get_local_deleter( ti ): 0; } - void * get_untyped_deleter() const BOOST_SP_NOEXCEPT + void * get_untyped_deleter() const noexcept { return pi_? pi_->get_untyped_deleter(): 0; } - std::size_t hash_value() const BOOST_SP_NOEXCEPT + std::size_t hash_value() const noexcept { return sp_hash_pointer( pi_ ); } @@ -502,14 +501,14 @@ private: public: - BOOST_CONSTEXPR weak_count() BOOST_SP_NOEXCEPT: pi_(0) + BOOST_CONSTEXPR weak_count() noexcept: pi_(0) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif { } - weak_count(shared_count const & r) BOOST_SP_NOEXCEPT: pi_(r.pi_) + weak_count(shared_count const & r) noexcept: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif @@ -517,7 +516,7 @@ public: if(pi_ != 0) pi_->weak_add_ref(); } - weak_count(weak_count const & r) BOOST_SP_NOEXCEPT: pi_(r.pi_) + weak_count(weak_count const & r) noexcept: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif @@ -527,7 +526,7 @@ public: // Move support - weak_count(weak_count && r) BOOST_SP_NOEXCEPT: pi_(r.pi_) + weak_count(weak_count && r) noexcept: pi_(r.pi_) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif @@ -535,7 +534,7 @@ public: r.pi_ = 0; } - ~weak_count() /*BOOST_SP_NOEXCEPT*/ + ~weak_count() /*noexcept*/ { if(pi_ != 0) pi_->weak_release(); #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) @@ -543,7 +542,7 @@ public: #endif } - weak_count & operator= (shared_count const & r) BOOST_SP_NOEXCEPT + weak_count & operator= (shared_count const & r) noexcept { sp_counted_base * tmp = r.pi_; @@ -557,7 +556,7 @@ public: return *this; } - weak_count & operator= (weak_count const & r) BOOST_SP_NOEXCEPT + weak_count & operator= (weak_count const & r) noexcept { sp_counted_base * tmp = r.pi_; @@ -571,44 +570,44 @@ public: return *this; } - void swap(weak_count & r) BOOST_SP_NOEXCEPT + void swap(weak_count & r) noexcept { sp_counted_base * tmp = r.pi_; r.pi_ = pi_; pi_ = tmp; } - long use_count() const BOOST_SP_NOEXCEPT + long use_count() const noexcept { return pi_ != 0? pi_->use_count(): 0; } - bool empty() const BOOST_SP_NOEXCEPT + bool empty() const noexcept { return pi_ == 0; } - bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT + bool operator==( weak_count const & r ) const noexcept { return pi_ == r.pi_; } - bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT + bool operator==( shared_count const & r ) const noexcept { return pi_ == r.pi_; } - bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT + bool operator<( weak_count const & r ) const noexcept { return std::less()( pi_, r.pi_ ); } - bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT + bool operator<( shared_count const & r ) const noexcept { return std::less()( pi_, r.pi_ ); } - std::size_t hash_value() const BOOST_SP_NOEXCEPT + std::size_t hash_value() const noexcept { return sp_hash_pointer( pi_ ); } @@ -625,7 +624,7 @@ inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) } } -inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_SP_NOEXCEPT: pi_( r.pi_ ) +inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ) noexcept: pi_( r.pi_ ) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -636,12 +635,12 @@ inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_ } } -inline bool shared_count::operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT +inline bool shared_count::operator==( weak_count const & r ) const noexcept { return pi_ == r.pi_; } -inline bool shared_count::operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT +inline bool shared_count::operator<( weak_count const & r ) const noexcept { return std::less()( pi_, r.pi_ ); }