forked from boostorg/smart_ptr
Add mixed shared_count/weak_count operator== overloads to avoid refcount manipulation
This commit is contained in:
@@ -489,11 +489,13 @@ public:
|
|||||||
return pi_ == 0;
|
return pi_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend inline bool operator==(shared_count const & a, shared_count const & b) BOOST_SP_NOEXCEPT
|
bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return a.pi_ == b.pi_;
|
return pi_ == r.pi_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT;
|
||||||
|
|
||||||
bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT
|
bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return std::less<sp_counted_base *>()( pi_, r.pi_ );
|
return std::less<sp_counted_base *>()( pi_, r.pi_ );
|
||||||
@@ -622,9 +624,14 @@ public:
|
|||||||
return pi_ == 0;
|
return pi_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend inline bool operator==(weak_count const & a, weak_count const & b) BOOST_SP_NOEXCEPT
|
bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return a.pi_ == b.pi_;
|
return pi_ == r.pi_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT
|
||||||
|
{
|
||||||
|
return pi_ == r.pi_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT
|
bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT
|
||||||
@@ -660,6 +667,11 @@ 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
|
||||||
|
{
|
||||||
|
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 BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return std::less<sp_counted_base *>()( pi_, r.pi_ );
|
return std::less<sp_counted_base *>()( pi_, r.pi_ );
|
||||||
|
Reference in New Issue
Block a user