Bug 1204790 - Prefer deleted function with public access specifiers instead of private in UniquePtr. r=nfroyd

This commit is contained in:
James Cheng 2015-09-15 19:18:00 +02:00
parent 35d72c0a9a
commit 78f9fe427d

View File

@ -315,7 +315,6 @@ public:
mTuple.swap(aOther.mTuple);
}
private:
UniquePtr(const UniquePtr& aOther) = delete; // construct using Move()!
void operator=(const UniquePtr& aOther) = delete; // assign using Move()!
};
@ -356,7 +355,6 @@ public:
static_assert(!IsReference<D>::value, "must provide a deleter instance");
}
private:
// delete[] knows how to handle *only* an array of a single class type. For
// delete[] to work correctly, it must know the size of each element, the
// fields and base classes of each element requiring destruction, and so on.
@ -369,7 +367,6 @@ private:
int>::Type aDummy = 0)
= delete;
public:
UniquePtr(Pointer aPtr,
typename Conditional<IsReference<D>::value,
D,
@ -389,7 +386,6 @@ public:
"rvalue deleter can't be stored by reference");
}
private:
// Forbidden for the same reasons as stated above.
template<typename U, typename V>
UniquePtr(U&& aU, V&& aV,
@ -398,7 +394,6 @@ private:
int>::Type aDummy = 0)
= delete;
public:
UniquePtr(UniquePtr&& aOther)
: mTuple(aOther.release(), Forward<DeleterType>(aOther.getDeleter()))
{}
@ -459,14 +454,11 @@ public:
}
}
private:
template<typename U>
void reset(U) = delete;
public:
void swap(UniquePtr& aOther) { mTuple.swap(aOther.mTuple); }
private:
UniquePtr(const UniquePtr& aOther) = delete; // construct using Move()!
void operator=(const UniquePtr& aOther) = delete; // assign using Move()!
};
@ -504,7 +496,6 @@ public:
delete[] aPtr;
}
private:
template<typename U>
void operator()(U* aPtr) const = delete;
};