diff options
| author | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-16 15:22:14 +0200 |
|---|---|---|
| committer | Tatiana Borisova <tatiana.borisova@qt.io> | 2024-04-26 20:11:14 +0200 |
| commit | 2606c0966669fe76300d4c818f8c05e778aacd23 (patch) | |
| tree | 8e35c66076aefe79399073148f1cffeed0c17386 /src/corelib/tools/qbitarray.h | |
| parent | 913442a75a269048bea7968aa2708888e10611c4 (diff) | |
QBitArray: use new comparison helper macros
Replace public friend operators operator==(), operator!=() of
QBitArray to friend method comparesEqual() and
Q_DECLARE_EQUALITY_COMPARABLE macro.
Task-number: QTBUG-120304
Change-Id: I6b47111c144016b3aa05f01c8035c32d164291ad
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/tools/qbitarray.h')
| -rw-r--r-- | src/corelib/tools/qbitarray.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h index 4f99e693eb8..b9c36b5320b 100644 --- a/src/corelib/tools/qbitarray.h +++ b/src/corelib/tools/qbitarray.h @@ -116,8 +116,10 @@ public: QBitArray operator~() const; #endif - inline bool operator==(const QBitArray &other) const { return d == other.d; } - inline bool operator!=(const QBitArray &other) const { return d != other.d; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QBitArray &other) const { return comparesEqual(d, other.d); } + inline bool operator!=(const QBitArray &other) const { return !operator==(other); } +#endif bool fill(bool aval, qsizetype asize = -1) { *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; } @@ -134,6 +136,13 @@ public: typedef QByteArray::DataPointer DataPtr; inline DataPtr &data_ptr() { return d.data_ptr(); } inline const DataPtr &data_ptr() const { return d.data_ptr(); } + +private: + friend bool comparesEqual(const QBitArray &lhs, const QBitArray &rhs) noexcept + { + return lhs.d == rhs.d; + } + Q_DECLARE_EQUALITY_COMPARABLE(QBitArray) }; class QT6_ONLY(Q_CORE_EXPORT) QBitRef |
