/// RefCountedBase - A generic base class for objects that wish to
/// have their lifetimes managed using reference counts. Classes
/// subclass RefCountedBase to obtain such functionality, and are
-/// typically handled with IntrusivePtr "smart pointers" (see below)
+/// typically handled with IntrusiveRefCntPtr "smart pointers" (see below)
/// which automatically handle the management of reference counts.
/// Objects that subclass RefCountedBase should not be allocated on
/// the stack, as invoking "delete" (which is called when the
retain();
}
- 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);
return *this;
}
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>