QUtf8StringView: use more comparison helper macros
Convert the last relational operators to using the macros. Task-number: QTBUG-117661 Change-Id: I5c4c890527d1a3c9500e98f47881d2e17b101ca9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
7068418a13
commit
868a5342bb
@ -314,28 +314,20 @@ private:
|
|||||||
QBasicUtf8StringView<false>(rhs.data(), rhs.size()));
|
QBasicUtf8StringView<false>(rhs.data(), rhs.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] friend inline bool operator==(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
|
friend bool
|
||||||
|
comparesEqual(const QBasicUtf8StringView &lhs, const QBasicUtf8StringView &rhs) noexcept
|
||||||
{
|
{
|
||||||
return lhs.size() == rhs.size()
|
return lhs.size() == rhs.size()
|
||||||
&& QtPrivate::equalStrings(QBasicUtf8StringView<false>(lhs.data(), lhs.size()),
|
&& QtPrivate::equalStrings(QBasicUtf8StringView<false>(lhs.data(), lhs.size()),
|
||||||
QBasicUtf8StringView<false>(rhs.data(), rhs.size()));
|
QBasicUtf8StringView<false>(rhs.data(), rhs.size()));
|
||||||
}
|
}
|
||||||
[[nodiscard]] friend inline bool operator!=(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
|
friend Qt::strong_ordering
|
||||||
{ return !operator==(lhs, rhs); }
|
compareThreeWay(const QBasicUtf8StringView &lhs, const QBasicUtf8StringView &rhs) noexcept
|
||||||
|
{
|
||||||
#ifdef __cpp_impl_three_way_comparison
|
const int res = QBasicUtf8StringView::compare(lhs, rhs);
|
||||||
[[nodiscard]] friend inline auto operator<=>(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
|
return Qt::compareThreeWay(res, 0);
|
||||||
{ return QBasicUtf8StringView::compare(lhs, rhs) <=> 0; }
|
}
|
||||||
#else
|
Q_DECLARE_STRONGLY_ORDERED(QBasicUtf8StringView)
|
||||||
[[nodiscard]] friend inline bool operator<=(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
|
|
||||||
{ return QBasicUtf8StringView::compare(lhs, rhs) <= 0; }
|
|
||||||
[[nodiscard]] friend inline bool operator>=(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
|
|
||||||
{ return QBasicUtf8StringView::compare(lhs, rhs) >= 0; }
|
|
||||||
[[nodiscard]] friend inline bool operator<(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
|
|
||||||
{ return QBasicUtf8StringView::compare(lhs, rhs) < 0; }
|
|
||||||
[[nodiscard]] friend inline bool operator>(QBasicUtf8StringView lhs, QBasicUtf8StringView rhs) noexcept
|
|
||||||
{ return QBasicUtf8StringView::compare(lhs, rhs) > 0; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
friend bool
|
friend bool
|
||||||
comparesEqual(const QBasicUtf8StringView &lhs, const QLatin1StringView &rhs) noexcept
|
comparesEqual(const QBasicUtf8StringView &lhs, const QLatin1StringView &rhs) noexcept
|
||||||
|
Loading…
x
Reference in New Issue
Block a user