mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 21:24:40 +02:00
Add more BOOST_SP_NOEXCEPT
This commit is contained in:
@@ -455,27 +455,27 @@ public:
|
|||||||
return state_;
|
return state_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void dispose() {
|
virtual void dispose() BOOST_SP_NOEXCEPT {
|
||||||
sp_array_destroy<E>(state_.allocator(),
|
sp_array_destroy<E>(state_.allocator(),
|
||||||
sp_array_start<sp_array_base, type>(this), state_.size());
|
sp_array_start<sp_array_base, type>(this), state_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void destroy() {
|
virtual void destroy() BOOST_SP_NOEXCEPT {
|
||||||
sp_array_creator<allocator, sp_array_base> other(state_.allocator(),
|
sp_array_creator<allocator, sp_array_base> other(state_.allocator(),
|
||||||
state_.size());
|
state_.size());
|
||||||
this->~sp_array_base();
|
this->~sp_array_base();
|
||||||
other.destroy(this);
|
other.destroy(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* get_deleter(const sp_typeinfo&) {
|
virtual void* get_deleter(const sp_typeinfo&) BOOST_SP_NOEXCEPT {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* get_local_deleter(const sp_typeinfo&) {
|
virtual void* get_local_deleter(const sp_typeinfo&) BOOST_SP_NOEXCEPT {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* get_untyped_deleter() {
|
virtual void* get_untyped_deleter() BOOST_SP_NOEXCEPT {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -101,13 +101,13 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit local_counted_impl( shared_count const& pn ): pn_( pn )
|
explicit local_counted_impl( shared_count const& pn ) BOOST_SP_NOEXCEPT: pn_( pn )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||||
|
|
||||||
explicit local_counted_impl( shared_count && pn ): pn_( std::move(pn) )
|
explicit local_counted_impl( shared_count && pn ) BOOST_SP_NOEXCEPT: pn_( std::move(pn) )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
D& deleter()
|
D& deleter() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return d_;
|
return d_;
|
||||||
}
|
}
|
||||||
@@ -74,12 +74,12 @@ template<> class local_sp_deleter<void>
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class D> D * get_local_deleter( local_sp_deleter<D> * p )
|
template<class D> D * get_local_deleter( local_sp_deleter<D> * p ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return &p->deleter();
|
return &p->deleter();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void * get_local_deleter( local_sp_deleter<void> * /*p*/ )
|
inline void * get_local_deleter( local_sp_deleter<void> * /*p*/ ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,8 @@
|
|||||||
#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/detail/workaround.hpp>
|
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
|
||||||
|
#include <boost/config/workaround.hpp>
|
||||||
// In order to avoid circular dependencies with Boost.TR1
|
// In order to avoid circular dependencies with Boost.TR1
|
||||||
// we make sure that our include of <memory> doesn't try to
|
// we make sure that our include of <memory> doesn't try to
|
||||||
// pull in the TR1 headers: that's why we use this header
|
// pull in the TR1 headers: that's why we use this header
|
||||||
@@ -118,14 +119,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BOOST_CONSTEXPR shared_count(): pi_(0) // nothrow
|
BOOST_CONSTEXPR shared_count() BOOST_SP_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 ): pi_( pi ) // nothrow
|
BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ) BOOST_SP_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
|
||||||
@@ -421,7 +422,7 @@ public:
|
|||||||
r.release();
|
r.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
~shared_count() // nothrow
|
~shared_count() /*BOOST_SP_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)
|
||||||
@@ -429,7 +430,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_count(shared_count const & r): pi_(r.pi_) // nothrow
|
shared_count(shared_count const & r) BOOST_SP_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
|
||||||
@@ -439,7 +440,7 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||||
|
|
||||||
shared_count(shared_count && r): pi_(r.pi_) // nothrow
|
shared_count(shared_count && r) BOOST_SP_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
|
||||||
@@ -450,9 +451,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 ); // constructs an empty *this 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 & operator= (shared_count const & r) // nothrow
|
shared_count & operator= (shared_count const & r) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
sp_counted_base * tmp = r.pi_;
|
sp_counted_base * tmp = r.pi_;
|
||||||
|
|
||||||
@@ -466,49 +467,49 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(shared_count & r) // nothrow
|
void swap(shared_count & r) BOOST_SP_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 // nothrow
|
long use_count() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pi_ != 0? pi_->use_count(): 0;
|
return pi_ != 0? pi_->use_count(): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unique() const // nothrow
|
bool unique() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return use_count() == 1;
|
return use_count() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool empty() const // nothrow
|
bool empty() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pi_ == 0;
|
return pi_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend inline bool operator==(shared_count const & a, shared_count const & b)
|
friend inline bool operator==(shared_count const & a, shared_count const & b) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return a.pi_ == b.pi_;
|
return a.pi_ == b.pi_;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend inline bool operator<(shared_count const & a, shared_count const & b)
|
friend inline bool operator<(shared_count const & a, shared_count const & b) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
|
return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
void * get_deleter( sp_typeinfo const & ti ) const
|
void * get_deleter( sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pi_? pi_->get_deleter( ti ): 0;
|
return pi_? pi_->get_deleter( ti ): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * get_local_deleter( sp_typeinfo const & ti ) const
|
void * get_local_deleter( sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pi_? pi_->get_local_deleter( ti ): 0;
|
return pi_? pi_->get_local_deleter( ti ): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * get_untyped_deleter() const
|
void * get_untyped_deleter() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pi_? pi_->get_untyped_deleter(): 0;
|
return pi_? pi_->get_untyped_deleter(): 0;
|
||||||
}
|
}
|
||||||
@@ -529,14 +530,14 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BOOST_CONSTEXPR weak_count(): pi_(0) // nothrow
|
BOOST_CONSTEXPR weak_count() BOOST_SP_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): pi_(r.pi_) // nothrow
|
weak_count(shared_count const & r) BOOST_SP_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
|
||||||
@@ -544,7 +545,7 @@ public:
|
|||||||
if(pi_ != 0) pi_->weak_add_ref();
|
if(pi_ != 0) pi_->weak_add_ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
weak_count(weak_count const & r): pi_(r.pi_) // nothrow
|
weak_count(weak_count const & r) BOOST_SP_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
|
||||||
@@ -556,7 +557,7 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||||
|
|
||||||
weak_count(weak_count && r): pi_(r.pi_) // nothrow
|
weak_count(weak_count && r) BOOST_SP_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
|
||||||
@@ -566,7 +567,7 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
~weak_count() // nothrow
|
~weak_count() /*BOOST_SP_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)
|
||||||
@@ -574,7 +575,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
weak_count & operator= (shared_count const & r) // nothrow
|
weak_count & operator= (shared_count const & r) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
sp_counted_base * tmp = r.pi_;
|
sp_counted_base * tmp = r.pi_;
|
||||||
|
|
||||||
@@ -588,7 +589,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
weak_count & operator= (weak_count const & r) // nothrow
|
weak_count & operator= (weak_count const & r) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
sp_counted_base * tmp = r.pi_;
|
sp_counted_base * tmp = r.pi_;
|
||||||
|
|
||||||
@@ -602,29 +603,29 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(weak_count & r) // nothrow
|
void swap(weak_count & r) BOOST_SP_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 // nothrow
|
long use_count() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pi_ != 0? pi_->use_count(): 0;
|
return pi_ != 0? pi_->use_count(): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool empty() const // nothrow
|
bool empty() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pi_ == 0;
|
return pi_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend inline bool operator==(weak_count const & a, weak_count const & b)
|
friend inline bool operator==(weak_count const & a, weak_count const & b) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return a.pi_ == b.pi_;
|
return a.pi_ == b.pi_;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend inline bool operator<(weak_count const & a, weak_count const & b)
|
friend inline bool operator<(weak_count const & a, weak_count const & b) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return std::less<sp_counted_base *>()(a.pi_, b.pi_);
|
return std::less<sp_counted_base *>()(a.pi_, b.pi_);
|
||||||
}
|
}
|
||||||
@@ -641,7 +642,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 ): pi_( r.pi_ )
|
inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_SP_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
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
#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 <atomic>
|
#include <atomic>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -26,17 +27,17 @@ namespace boost
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
inline void atomic_increment( std::atomic_int_least32_t * pw )
|
inline void atomic_increment( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
pw->fetch_add( 1, std::memory_order_relaxed );
|
pw->fetch_add( 1, std::memory_order_relaxed );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw )
|
inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pw->fetch_sub( 1, std::memory_order_acq_rel );
|
return pw->fetch_sub( 1, std::memory_order_acq_rel );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw )
|
inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
// long r = *pw;
|
// long r = *pw;
|
||||||
// if( r != 0 ) ++*pw;
|
// if( r != 0 ) ++*pw;
|
||||||
@@ -70,41 +71,41 @@ 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;
|
||||||
|
|
||||||
// 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
|
||||||
{
|
{
|
||||||
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
|
||||||
{
|
{
|
||||||
atomic_increment( &use_count_ );
|
atomic_increment( &use_count_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool add_ref_lock() // true on success
|
bool add_ref_lock() BOOST_SP_NOEXCEPT // true on success
|
||||||
{
|
{
|
||||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void release() // nothrow
|
void release() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
if( atomic_decrement( &use_count_ ) == 1 )
|
if( atomic_decrement( &use_count_ ) == 1 )
|
||||||
{
|
{
|
||||||
@@ -113,12 +114,12 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void weak_add_ref() // nothrow
|
void weak_add_ref() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
atomic_increment( &weak_count_ );
|
atomic_increment( &weak_count_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
void weak_release() // nothrow
|
void weak_release() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
if( atomic_decrement( &weak_count_ ) == 1 )
|
if( atomic_decrement( &weak_count_ ) == 1 )
|
||||||
{
|
{
|
||||||
@@ -126,7 +127,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long use_count() const // nothrow
|
long use_count() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return use_count_.load( std::memory_order_acquire );
|
return use_count_.load( std::memory_order_acquire );
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <boost/checked_delete.hpp>
|
#include <boost/checked_delete.hpp>
|
||||||
#include <boost/smart_ptr/detail/sp_counted_base.hpp>
|
#include <boost/smart_ptr/detail/sp_counted_base.hpp>
|
||||||
|
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
|
||||||
#include <boost/core/addressof.hpp>
|
#include <boost/core/addressof.hpp>
|
||||||
|
|
||||||
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
||||||
@@ -55,12 +56,12 @@ namespace detail
|
|||||||
|
|
||||||
template<class D> class local_sp_deleter;
|
template<class D> class local_sp_deleter;
|
||||||
|
|
||||||
template<class D> D * get_local_deleter( D * /*p*/ )
|
template<class D> D * get_local_deleter( D * /*p*/ ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class D> D * get_local_deleter( local_sp_deleter<D> * p );
|
template<class D> D * get_local_deleter( local_sp_deleter<D> * p ) BOOST_SP_NOEXCEPT;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void dispose() // nothrow
|
virtual void dispose() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||||
boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
|
boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
|
||||||
@@ -92,17 +93,17 @@ public:
|
|||||||
boost::checked_delete( px_ );
|
boost::checked_delete( px_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_deleter( sp_typeinfo const & )
|
virtual void * get_deleter( sp_typeinfo const & ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_local_deleter( sp_typeinfo const & )
|
virtual void * get_local_deleter( sp_typeinfo const & ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_untyped_deleter()
|
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -167,22 +168,22 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void dispose() // nothrow
|
virtual void dispose() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
del( ptr );
|
del( ptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_deleter( sp_typeinfo const & ti )
|
virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
|
return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_local_deleter( sp_typeinfo const & ti )
|
virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0;
|
return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_untyped_deleter()
|
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return &reinterpret_cast<char&>( del );
|
return &reinterpret_cast<char&>( del );
|
||||||
}
|
}
|
||||||
@@ -241,12 +242,12 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void dispose() // nothrow
|
virtual void dispose() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
d_( p_ );
|
d_( p_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void destroy() // nothrow
|
virtual void destroy() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
||||||
|
|
||||||
@@ -265,17 +266,17 @@ public:
|
|||||||
a2.deallocate( this, 1 );
|
a2.deallocate( this, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_deleter( sp_typeinfo const & ti )
|
virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0;
|
return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_local_deleter( sp_typeinfo const & ti )
|
virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0;
|
return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void * get_untyped_deleter()
|
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return &reinterpret_cast<char&>( d_ );
|
return &reinterpret_cast<char&>( d_ );
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/smart_ptr/detail/yield_k.hpp>
|
#include <boost/smart_ptr/detail/yield_k.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@@ -32,12 +33,12 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool try_lock()
|
bool try_lock() BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !v_.test_and_set( std::memory_order_acquire );
|
return !v_.test_and_set( std::memory_order_acquire );
|
||||||
}
|
}
|
||||||
|
|
||||||
void lock()
|
void lock() BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
for( unsigned k = 0; !try_lock(); ++k )
|
for( unsigned k = 0; !try_lock(); ++k )
|
||||||
{
|
{
|
||||||
@@ -45,7 +46,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlock()
|
void unlock() BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
v_ .clear( std::memory_order_release );
|
v_ .clear( std::memory_order_release );
|
||||||
}
|
}
|
||||||
@@ -63,12 +64,12 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
explicit scoped_lock( spinlock & sp ) BOOST_NOEXCEPT: sp_( sp )
|
||||||
{
|
{
|
||||||
sp.lock();
|
sp.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
~scoped_lock()
|
~scoped_lock() /*BOOST_NOEXCEPT*/
|
||||||
{
|
{
|
||||||
sp_.unlock();
|
sp_.unlock();
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ namespace detail
|
|||||||
|
|
||||||
#endif // !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME
|
#endif // !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME
|
||||||
|
|
||||||
inline void yield( unsigned k )
|
inline void yield( unsigned k ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
if( k < 4 )
|
if( k < 4 )
|
||||||
{
|
{
|
||||||
|
@@ -797,7 +797,7 @@ public:
|
|||||||
return px == r.px && pn == r.pn;
|
return px == r.px && pn == r.pn;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::detail::shared_count _internal_count() const BOOST_NOEXCEPT
|
boost::detail::shared_count _internal_count() const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return pn;
|
return pn;
|
||||||
}
|
}
|
||||||
@@ -1022,7 +1022,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
esft2_deleter_wrapper()
|
esft2_deleter_wrapper() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user