diff options
author | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-23 15:16:40 +0200 |
---|---|---|
committer | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-05-14 00:32:35 +0200 |
commit | ed71387d1cc06afff42ac844a3887778685ce793 (patch) | |
tree | 5399d3d064e65bc689c8e577c68928501844f819 /src/corelib/thread | |
parent | 6688b8eaff657aeac4fd2200ed12dba6f5ab845a (diff) |
QtPrivate::ResultIteratorBase: use modernize comparisons
Replace class operators operator==(), operator!=() of
QtPrivate::ResultIteratorBase to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.
Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of
current comparison methods and replace them with a friend.
Task-number: QTBUG-120304
Change-Id: Ib9a50a400df86d1dc034d2a0cfee804109a2b93f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qresultstore.cpp | 10 | ||||
-rw-r--r-- | src/corelib/thread/qresultstore.h | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/corelib/thread/qresultstore.cpp b/src/corelib/thread/qresultstore.cpp index 14ed7c6b87..8b7601f5b0 100644 --- a/src/corelib/thread/qresultstore.cpp +++ b/src/corelib/thread/qresultstore.cpp @@ -88,16 +88,6 @@ void ResultIteratorBase::batchedAdvance() m_vectorIndex = 0; } -bool ResultIteratorBase::operator==(const ResultIteratorBase &other) const -{ - return (mapIterator == other.mapIterator && m_vectorIndex == other.m_vectorIndex); -} - -bool ResultIteratorBase::operator!=(const ResultIteratorBase &other) const -{ - return !operator==(other); -} - bool ResultIteratorBase::isVector() const { return mapIterator.value().isVector(); diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 30ce1fe904..f21068206f 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -46,12 +46,21 @@ public: ResultIteratorBase operator++(); int batchSize() const; void batchedAdvance(); +#if QT_CORE_REMOVED_SINCE(6, 8) bool operator==(const ResultIteratorBase &other) const; bool operator!=(const ResultIteratorBase &other) const; +#endif bool isVector() const; bool canIncrementVectorIndex() const; bool isValid() const; +private: + friend bool comparesEqual(const ResultIteratorBase &lhs, + const ResultIteratorBase &rhs) noexcept + { + return (lhs.mapIterator == rhs.mapIterator && lhs.m_vectorIndex == rhs.m_vectorIndex); + } + Q_DECLARE_EQUALITY_COMPARABLE(ResultIteratorBase) protected: QMap<int, ResultItem>::const_iterator mapIterator; int m_vectorIndex; |