mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1297304 - Add operator== overloads for comparing HandleRefPtrs to their raw Handles. r=bholley
MozReview-Commit-ID: jTQZXyNbqM
This commit is contained in:
parent
c6d0866a58
commit
c461447b20
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user