mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 05:07:21 +02:00
Self-assignment optimization
[SVN r22233]
This commit is contained in:
@ -395,9 +395,13 @@ public:
|
|||||||
shared_count & operator= (shared_count const & r) // nothrow
|
shared_count & operator= (shared_count const & r) // nothrow
|
||||||
{
|
{
|
||||||
sp_counted_base * tmp = r.pi_;
|
sp_counted_base * tmp = r.pi_;
|
||||||
if(tmp != 0) tmp->add_ref_copy();
|
|
||||||
if(pi_ != 0) pi_->release();
|
if(tmp != pi_)
|
||||||
pi_ = tmp;
|
{
|
||||||
|
if(tmp != 0) tmp->add_ref_copy();
|
||||||
|
if(pi_ != 0) pi_->release();
|
||||||
|
pi_ = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user