add == and != operator to refptr template
This commit is contained in:
parent
ab63af563f
commit
9b28b3ccac
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user