summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qcomparehelpers.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-11-30 01:38:39 +0100
committerIvan Solovev <ivan.solovev@qt.io>2023-12-07 23:36:15 +0100
commitc39fff0da59ac23a4b185aada4ee653f69a705d5 (patch)
tree1058eac45d960bd7dc07ddd8690ad2429ceb65b5 /src/corelib/global/qcomparehelpers.h
parentccd0dc7f6d820b85cff94b890ceb4c6ffd9ae9d1 (diff)
Add missing <=> 0 operator to Qt ordering types
It's required by the standard, see e.g. [1] and the eel.is links in the code. [ChangeLog][QtCore][QPartialOrdering] Added three-way comparison operator (<=>) against literal zero, available when compiling in C++20 mode. [1] https://en.cppreference.com/w/cpp/utility/compare/partial_ordering#Comparisons Change-Id: I8a3b76661400930c6e247cf5b138ff52bf784395 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/global/qcomparehelpers.h')
-rw-r--r--src/corelib/global/qcomparehelpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/global/qcomparehelpers.h b/src/corelib/global/qcomparehelpers.h
index d7e007b8b0..0394703e17 100644
--- a/src/corelib/global/qcomparehelpers.h
+++ b/src/corelib/global/qcomparehelpers.h
@@ -27,6 +27,8 @@
QT_BEGIN_NAMESPACE
+class QPartialOrdering;
+
namespace QtOrderingPrivate {
#ifdef __cpp_lib_three_way_comparison
@@ -44,6 +46,9 @@ QT_STD_MAP(weak)
QT_STD_MAP(strong)
#undef QT_STD_MAP
+template <> struct StdOrdering<QPartialOrdering> : q20::type_identity<std::partial_ordering> {};
+template <> struct QtOrdering<QPartialOrdering> : q20::type_identity< Qt::partial_ordering> {};
+
template <typename In> constexpr auto to_std(In in) noexcept
-> typename QtOrderingPrivate::StdOrdering<In>::type
{ return in; }