fix: use const qualifier for operator==() and allow other comparisons

This fixes an implicit behavior changed by C++17.

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-07-26 12:53:28 -03:00
parent 1a6cb9ee99
commit 6fe55a79f1
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -77,10 +77,12 @@ public:
{ {
return m_ptr; return m_ptr;
} }
bool operator==(const shared_qobject_ptr<T>& other) { template<typename U>
bool operator==(const shared_qobject_ptr<U>& other) const {
return m_ptr == other.m_ptr; return m_ptr == other.m_ptr;
} }
bool operator!=(const shared_qobject_ptr<T>& other) { template<typename U>
bool operator!=(const shared_qobject_ptr<U>& other) const {
return m_ptr != other.m_ptr; return m_ptr != other.m_ptr;
} }