Index: compiled/intrusive_ptr.h |
=================================================================== |
--- a/compiled/intrusive_ptr.h |
+++ b/compiled/intrusive_ptr.h |
@@ -91,25 +91,27 @@ |
} |
~intrusive_ptr() |
{ |
if (mPointer) |
mPointer->ReleaseRef(); |
} |
- intrusive_ptr& operator=(intrusive_ptr& other) |
+ intrusive_ptr& operator=(const intrusive_ptr& other) |
hub
2017/09/27 17:30:03
it should be const & here.
|
{ |
- intrusive_ptr(other).swap(*this); |
+ if (this != &other) |
hub
2017/09/27 17:30:03
we shall insure that the self assignment is a noop
|
+ intrusive_ptr(other).swap(*this); |
return *this; |
} |
intrusive_ptr& operator=(intrusive_ptr&& other) |
{ |
- intrusive_ptr(std::move(other)).swap(*this); |
+ if (this != &other) |
hub
2017/09/27 17:30:03
same here.
|
+ intrusive_ptr(std::move(other)).swap(*this); |
return *this; |
} |
intrusive_ptr& operator=(T* other) |
{ |
intrusive_ptr(other).swap(*this); |
return *this; |
} |