Remove uses of BOOST_SP_NOEXCEPT from shared_count.hpp

This commit is contained in:
Peter Dimov
2024-10-02 21:50:05 +03:00
parent 9ed43780e4
commit dbceed6210

View File

@ -22,7 +22,6 @@
#include <boost/smart_ptr/detail/sp_counted_base.hpp> #include <boost/smart_ptr/detail/sp_counted_base.hpp>
#include <boost/smart_ptr/detail/sp_counted_impl.hpp> #include <boost/smart_ptr/detail/sp_counted_impl.hpp>
#include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp>
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
#include <boost/smart_ptr/detail/deprecated_macros.hpp> #include <boost/smart_ptr/detail/deprecated_macros.hpp>
#include <boost/core/checked_delete.hpp> #include <boost/core/checked_delete.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
@ -121,14 +120,14 @@ private:
public: public:
BOOST_CONSTEXPR shared_count() BOOST_SP_NOEXCEPT: pi_(0) BOOST_CONSTEXPR shared_count() noexcept: pi_(0)
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id) , id_(shared_count_id)
#endif #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) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id) , id_(shared_count_id)
#endif #endif
@ -389,7 +388,7 @@ public:
r.release(); r.release();
} }
~shared_count() /*BOOST_SP_NOEXCEPT*/ ~shared_count() /*noexcept*/
{ {
if( pi_ != 0 ) pi_->release(); if( pi_ != 0 ) pi_->release();
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
@ -397,7 +396,7 @@ public:
#endif #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) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id) , id_(shared_count_id)
#endif #endif
@ -405,7 +404,7 @@ public:
if( pi_ != 0 ) pi_->add_ref_copy(); 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) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id) , id_(shared_count_id)
#endif #endif
@ -414,9 +413,9 @@ public:
} }
explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 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_; sp_counted_base * tmp = r.pi_;
@ -430,58 +429,58 @@ public:
return *this; return *this;
} }
void swap(shared_count & r) BOOST_SP_NOEXCEPT void swap(shared_count & r) noexcept
{ {
sp_counted_base * tmp = r.pi_; sp_counted_base * tmp = r.pi_;
r.pi_ = pi_; r.pi_ = pi_;
pi_ = tmp; pi_ = tmp;
} }
long use_count() const BOOST_SP_NOEXCEPT long use_count() const noexcept
{ {
return pi_ != 0? pi_->use_count(): 0; return pi_ != 0? pi_->use_count(): 0;
} }
bool unique() const BOOST_SP_NOEXCEPT bool unique() const noexcept
{ {
return use_count() == 1; return use_count() == 1;
} }
bool empty() const BOOST_SP_NOEXCEPT bool empty() const noexcept
{ {
return pi_ == 0; 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_; 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<sp_counted_base *>()( pi_, r.pi_ ); return std::less<sp_counted_base *>()( 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; 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; 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; 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_ ); return sp_hash_pointer( pi_ );
} }
@ -502,14 +501,14 @@ private:
public: public:
BOOST_CONSTEXPR weak_count() BOOST_SP_NOEXCEPT: pi_(0) BOOST_CONSTEXPR weak_count() noexcept: pi_(0)
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(weak_count_id) , id_(weak_count_id)
#endif #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) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(weak_count_id) , id_(weak_count_id)
#endif #endif
@ -517,7 +516,7 @@ public:
if(pi_ != 0) pi_->weak_add_ref(); 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) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(weak_count_id) , id_(weak_count_id)
#endif #endif
@ -527,7 +526,7 @@ public:
// Move support // 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) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(weak_count_id) , id_(weak_count_id)
#endif #endif
@ -535,7 +534,7 @@ public:
r.pi_ = 0; r.pi_ = 0;
} }
~weak_count() /*BOOST_SP_NOEXCEPT*/ ~weak_count() /*noexcept*/
{ {
if(pi_ != 0) pi_->weak_release(); if(pi_ != 0) pi_->weak_release();
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
@ -543,7 +542,7 @@ public:
#endif #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_; sp_counted_base * tmp = r.pi_;
@ -557,7 +556,7 @@ public:
return *this; 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_; sp_counted_base * tmp = r.pi_;
@ -571,44 +570,44 @@ public:
return *this; return *this;
} }
void swap(weak_count & r) BOOST_SP_NOEXCEPT void swap(weak_count & r) noexcept
{ {
sp_counted_base * tmp = r.pi_; sp_counted_base * tmp = r.pi_;
r.pi_ = pi_; r.pi_ = pi_;
pi_ = tmp; pi_ = tmp;
} }
long use_count() const BOOST_SP_NOEXCEPT long use_count() const noexcept
{ {
return pi_ != 0? pi_->use_count(): 0; return pi_ != 0? pi_->use_count(): 0;
} }
bool empty() const BOOST_SP_NOEXCEPT bool empty() const noexcept
{ {
return pi_ == 0; 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_; 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_; 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<sp_counted_base *>()( pi_, r.pi_ ); return std::less<sp_counted_base *>()( pi_, r.pi_ );
} }
bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT bool operator<( shared_count const & r ) const noexcept
{ {
return std::less<sp_counted_base *>()( pi_, r.pi_ ); return std::less<sp_counted_base *>()( pi_, r.pi_ );
} }
std::size_t hash_value() const BOOST_SP_NOEXCEPT std::size_t hash_value() const noexcept
{ {
return sp_hash_pointer( pi_ ); 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) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id) , id_(shared_count_id)
#endif #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_; 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<sp_counted_base *>()( pi_, r.pi_ ); return std::less<sp_counted_base *>()( pi_, r.pi_ );
} }