mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-30 12:47:28 +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
|
||||
{
|
||||
sp_counted_base * tmp = r.pi_;
|
||||
if(tmp != 0) tmp->add_ref_copy();
|
||||
if(pi_ != 0) pi_->release();
|
||||
pi_ = tmp;
|
||||
|
||||
if(tmp != pi_)
|
||||
{
|
||||
if(tmp != 0) tmp->add_ref_copy();
|
||||
if(pi_ != 0) pi_->release();
|
||||
pi_ = tmp;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user