Add BOOST_SP_NOEXCEPT to sp_counted_base_nt.hpp

This commit is contained in:
Peter Dimov
2019-01-28 21:24:09 +02:00
parent 053779f3ee
commit aa1341a6a2

View File

@ -19,6 +19,7 @@
// //
#include <boost/detail/sp_typeinfo.hpp> #include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
@ -40,43 +41,43 @@ private:
public: public:
sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) sp_counted_base() BOOST_SP_NOEXCEPT: use_count_( 1 ), weak_count_( 1 )
{ {
} }
virtual ~sp_counted_base() // nothrow virtual ~sp_counted_base() /*BOOST_SP_NOEXCEPT*/
{ {
} }
// dispose() is called when use_count_ drops to zero, to release // dispose() is called when use_count_ drops to zero, to release
// the resources managed by *this. // the resources managed by *this.
virtual void dispose() = 0; // nothrow virtual void dispose() BOOST_SP_NOEXCEPT = 0; // nothrow
// destroy() is called when weak_count_ drops to zero. // destroy() is called when weak_count_ drops to zero.
virtual void destroy() // nothrow virtual void destroy() BOOST_SP_NOEXCEPT // nothrow
{ {
delete this; delete this;
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_untyped_deleter() = 0; virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0;
void add_ref_copy() void add_ref_copy() BOOST_SP_NOEXCEPT
{ {
++use_count_; ++use_count_;
} }
bool add_ref_lock() // true on success bool add_ref_lock() BOOST_SP_NOEXCEPT // true on success
{ {
if( use_count_ == 0 ) return false; if( use_count_ == 0 ) return false;
++use_count_; ++use_count_;
return true; return true;
} }
void release() // nothrow void release() BOOST_SP_NOEXCEPT
{ {
if( --use_count_ == 0 ) if( --use_count_ == 0 )
{ {
@ -85,12 +86,12 @@ public:
} }
} }
void weak_add_ref() // nothrow void weak_add_ref() BOOST_SP_NOEXCEPT
{ {
++weak_count_; ++weak_count_;
} }
void weak_release() // nothrow void weak_release() BOOST_SP_NOEXCEPT
{ {
if( --weak_count_ == 0 ) if( --weak_count_ == 0 )
{ {
@ -98,7 +99,7 @@ public:
} }
} }
long use_count() const // nothrow long use_count() const BOOST_SP_NOEXCEPT
{ {
return use_count_; return use_count_;
} }