diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index f057fa0bb78..a6733834384 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -539,6 +540,16 @@ public: explicit inline QByteArray(DataPointer &&dd) : d(std::move(dd)) {} private: + friend bool comparesEqual(const QByteArray &lhs, const QByteArrayView &rhs) noexcept + { return QByteArrayView(lhs) == rhs; } + friend Qt::strong_ordering + compareThreeWay(const QByteArray &lhs, const QByteArrayView &rhs) noexcept + { + const int res = QtPrivate::compareMemory(QByteArrayView(lhs), rhs); + return Qt::compareThreeWay(res, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QByteArray, QByteArrayView) + void reallocData(qsizetype alloc, QArrayData::AllocationOption option); void reallocGrowData(qsizetype n); void expand(qsizetype i); diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index 8cf04c40ea6..635b9cfa52f 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -297,10 +297,8 @@ private Q_SLOTS: void compare_QByteArray_QLatin1String() { compare_impl(); } void compare_QByteArray_QByteArray_data() { compare_data(); } void compare_QByteArray_QByteArray() { compare_impl(); } -#ifdef AMBIGUOUS_CALL void compare_QByteArray_QByteArrayView_data() { compare_data(); } void compare_QByteArray_QByteArrayView() { compare_impl(); } -#endif void compare_QByteArray_const_char_star_data() { compare_data(); } void compare_QByteArray_const_char_star() { compare_impl(); } @@ -318,10 +316,8 @@ private Q_SLOTS: void compare_QByteArrayView_QUtf8StringView() { compare_impl(); } void compare_QByteArrayView_QLatin1String_data() { compare_data(); } void compare_QByteArrayView_QLatin1String() { compare_impl(); } -#ifdef AMBIGUOUS_CALL void compare_QByteArrayView_QByteArray_data() { compare_data(); } void compare_QByteArrayView_QByteArray() { compare_impl(); } -#endif void compare_QByteArrayView_QByteArrayView_data() { compare_data(); } void compare_QByteArrayView_QByteArrayView() { compare_impl(); } #ifdef AMBIGUOUS_CALL