mirror of
https://github.com/znc/znc.git
synced 2026-08-07 01:13:25 +02:00
Fix CSmartPtr's operator== to actually work
The old code only worked when the CSmartPtr instance was at the left side of the comparison and comparing two CSmartPtr directly resulted in a compiler error. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1818 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -413,8 +413,6 @@ public:
|
||||
// Overloaded operators
|
||||
T& operator *() const { assert(m_pType); return *m_pType; }
|
||||
T* operator ->() const { assert(m_pType); return m_pType; }
|
||||
bool operator ==(T* rhs) const { return (m_pType == rhs); }
|
||||
bool operator ==(const CSmartPtr<T>& rhs) const { return (m_pType == *rhs); }
|
||||
|
||||
/**
|
||||
* @brief Attach() to a raw pointer
|
||||
@@ -508,5 +506,14 @@ private:
|
||||
unsigned int* m_puCount; //!< Counter of how many CSmartPtr's are referencing the same raw pointer
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
bool operator ==(T* lhs, const CSmartPtr<T>& rhs) { return (lhs == rhs.GetPtr()); }
|
||||
|
||||
template<typename T>
|
||||
bool operator ==(const CSmartPtr<T>& lhs, T* rhs) { return (lhs.GetPtr() == rhs); }
|
||||
|
||||
template<typename T>
|
||||
bool operator ==(const CSmartPtr<T>& lhs, const CSmartPtr<T>& rhs) { return (lhs.GetPtr() == rhs.GetPtr()); }
|
||||
|
||||
#endif // !_UTILS_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user