retain();
}
+ IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr& S) {
+ replace(S.getPtr());
+ return *this;
+ }
+
template <class X>
IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr<X>& S) {
replace(S.getPtr());
T* getPtr() const { return Obj; }
- typedef T * IntrusiveRefCntPtr::*unspecified_bool_type;
+ typedef T* (IntrusiveRefCntPtr::*unspecified_bool_type) () const;
operator unspecified_bool_type() const {
return Obj == 0 ? 0 : &IntrusiveRefCntPtr::getPtr;
}
void release() { if (Obj) Obj->Release(); }
void replace(T* S) {
- this_type(S).swap(this);
+ this_type(S).swap(*this);
}
};