Sync shared_count.hpp with trunk.

[SVN r51484]
This commit is contained in:
Peter Dimov
2009-02-28 19:59:56 +00:00
parent 55583ac749
commit a2c5208b8e

View File

@ -28,6 +28,7 @@
#include <boost/detail/bad_weak_ptr.hpp>
#include <boost/detail/sp_counted_base.hpp>
#include <boost/detail/sp_counted_impl.hpp>
#include <boost/detail/workaround.hpp>
// In order to avoid circular dependencies with Boost.TR1
// we make sure that our include of <memory> doesn't try to
// 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 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
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;
}
bool empty() const // nothrow
{
return pi_ == 0;
}
friend inline bool operator==(weak_count const & a, weak_count const & b)
{
return a.pi_ == b.pi_;