add == and != operator to refptr template

This commit is contained in:
Josh Holtrop 2011-02-09 16:58:15 -05:00
parent ab63af563f
commit 9b28b3ccac

View File

@ -17,6 +17,8 @@ class refptr
T & operator*() const;
T * operator->() const;
bool isNull() const { return m_ptr == NULL; }
bool operator==(const refptr<T> & right) const;
bool operator!=(const refptr<T> & right) const;
private:
void cloneFrom(const refptr<T> & orig);
@ -99,5 +101,15 @@ template <typename T> T * refptr<T>::operator->() const
return m_ptr;
}
template <typename T> bool refptr<T>::operator==(const refptr<T> & right) const
{
return m_ptr == right.m_ptr;
}
template <typename T> bool refptr<T>::operator!=(const refptr<T> & right) const
{
return m_ptr != right.m_ptr;
}
#endif