forked from boostorg/smart_ptr
Sync shared_count.hpp with trunk.
[SVN r51484]
This commit is contained in:
@ -28,6 +28,7 @@
|
|||||||
#include <boost/detail/bad_weak_ptr.hpp>
|
#include <boost/detail/bad_weak_ptr.hpp>
|
||||||
#include <boost/detail/sp_counted_base.hpp>
|
#include <boost/detail/sp_counted_base.hpp>
|
||||||
#include <boost/detail/sp_counted_impl.hpp>
|
#include <boost/detail/sp_counted_impl.hpp>
|
||||||
|
#include <boost/detail/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
|
||||||
@ -227,6 +228,18 @@ public:
|
|||||||
if( pi_ != 0 ) pi_->add_ref_copy();
|
if( pi_ != 0 ) pi_->add_ref_copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined( BOOST_HAS_RVALUE_REFS )
|
||||||
|
|
||||||
|
shared_count(shared_count && r): pi_(r.pi_) // nothrow
|
||||||
|
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||||
|
, id_(shared_count_id)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
r.pi_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 ); // constructs an empty *this when r.use_count() == 0
|
||||||
|
|
||||||
@ -368,6 +381,11 @@ public:
|
|||||||
return pi_ != 0? pi_->use_count(): 0;
|
return pi_ != 0? pi_->use_count(): 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool empty() const // nothrow
|
||||||
|
{
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
return a.pi_ == b.pi_;
|
return a.pi_ == b.pi_;
|
||||||
|
Reference in New Issue
Block a user