зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1294161 - Add operator== overloads for comparing HandlRefPtrs to their raw Handles. r=bholley
MozReview-Commit-ID: jTQZXyNbqM
This commit is contained in:
Родитель
9bfe388f26
Коммит
74db9034ce
|
@ -64,16 +64,6 @@ public:
|
|||
operator T() const { return mHandle; }
|
||||
T operator->() const { return mHandle; }
|
||||
|
||||
bool operator==(const HandleRefPtr<T>& aOther) const
|
||||
{
|
||||
return mHandle == aOther.mHandle;
|
||||
}
|
||||
|
||||
bool operator!=(const HandleRefPtr<T>& aOther) const
|
||||
{
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
void swap(HandleRefPtr<T>& aOther)
|
||||
{
|
||||
std::swap(mHandle, aOther.mHandle);
|
||||
|
@ -102,6 +92,42 @@ private:
|
|||
T mHandle;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline bool operator==(const HandleRefPtr<T>& aLHS, const HandleRefPtr<T>& aRHS)
|
||||
{
|
||||
return static_cast<T>(aLHS) == static_cast<T>(aRHS);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool operator==(const HandleRefPtr<T>& aLHS, T aRHS)
|
||||
{
|
||||
return static_cast<T>(aLHS) == aRHS;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool operator==(T aLHS, const HandleRefPtr<T>& aRHS)
|
||||
{
|
||||
return aLHS == static_cast<T>(aRHS);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool operator!=(const HandleRefPtr<T>& aLHS, const HandleRefPtr<T>& aRHS)
|
||||
{
|
||||
return !(aLHS == aRHS);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool operator!=(const HandleRefPtr<T>& aLHS, T aRHS)
|
||||
{
|
||||
return !(aLHS == aRHS);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool operator!=(T aLHS, const HandleRefPtr<T>& aRHS)
|
||||
{
|
||||
return !(aLHS == aRHS);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_HandleRefPtr_h
|
||||
|
|
Загрузка…
Ссылка в новой задаче