This way the constructors do all the hard work. No intended functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157773
91177308-0d34-0410-b5e6-
96231b3b80d8
- IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr& S) {
- replace(S.getPtr());
- return *this;
- }
-
-#if LLVM_USE_RVALUE_REFERENCES
- IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr&& S) {
- this_type(std::move(S)).swap(*this);
- return *this;
- }
-
- template <class X>
- IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr<X>&& S) {
- this_type(std::move(S)).swap(*this);
- return *this;
- }
-#endif
-
- template <class X>
- IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr<X>& S) {
- replace(S.getPtr());
- return *this;
- }
-
- IntrusiveRefCntPtr& operator=(T * S) {
- replace(S);
+ IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr S) {
+ swap(S);
private:
void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
private:
void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
-
- void replace(T* S) {
- this_type(S).swap(*this);
- }
};
template<class T, class U>
};
template<class T, class U>