Auf dieser Seite

Qt::partial_ordering Class

class Qt::partial_ordering

Qt::partial_ordering stellt das Ergebnis eines Vergleichs dar, bei dem die Reihenfolge der Ergebnisse keine Rolle spielt. Mehr dazu...

Überschrift: #include <QtCompare>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Seit: Qt 6.7

Öffentliche Funktionen

partial_ordering(std::partial_ordering stdorder)
operator std::partial_ordering() const

Statische öffentliche Mitglieder

const Qt::partial_ordering equivalent
const Qt::partial_ordering greater
const Qt::partial_ordering less
const Qt::partial_ordering unordered
bool is_eq(Qt::partial_ordering o)
bool is_gt(Qt::partial_ordering o)
bool is_gteq(Qt::partial_ordering o)
bool is_lt(Qt::partial_ordering o)
bool is_lteq(Qt::partial_ordering o)
bool is_neq(Qt::partial_ordering o)
bool operator!=(Qt::partial_ordering lhs, Qt::partial_ordering rhs)
bool operator==(Qt::partial_ordering lhs, Qt::partial_ordering rhs)

Ausführliche Beschreibung

Eine Drei-Wege-Vergleichsfunktion gibt typischerweise einen Wert vom Typ „ Qt::partial_ordering “ zurück. Eine solche Funktion vergleicht zwei Objekte und stellt fest, ob sie geordnet sind und, falls ja, in welcher Reihenfolge. Sie verwendet diesen Rückgabetyp, um anzugeben, dass es sich um eine partielle Ordnung handelt; das heißt, nicht alle Wertepaare sind geordnet.

Qt::partial_ordering hat vier Werte, die durch die folgenden symbolischen Konstanten dargestellt werden:

  • less bedeutet, dass der linke Operand kleiner ist als der rechte;
  • equivalent bedeutet, dass die beiden Operanden gleich sind;
  • greater bedeutet, dass der linke Operand größer ist als der rechte;
  • unordered bedeutet, dass die beiden Operanden nicht geordnet sind.

Qt::partial_ordering wird idiomatisch verwendet, indem eine Instanz mit dem Literal Null verglichen wird, zum Beispiel so:

// given a, b, c, d as objects of some type that allows for a 3-way compare,
// and a compare function declared as follows:

Qt::partial_ordering compare(T lhs, T rhs); // defined out-of-line
~~~

Qt::partial_ordering result = compare(a, b);
if (result < 0) {
    // a is less than b
}

if (compare(c, d) >= 0) {
    // c is greater than or equal to d
}

Der Vergleich von „ Qt::partial_ordering::unordered “ mit dem Literal 0 liefert immer ein „ false “-Ergebnis.

Siehe auch „ Qt::strong_ordering “, „ Qt::weak_ordering “ und „Übersicht über Vergleichstypen“.

Dokumentation zu Mitgliedsfunktionen

[constexpr noexcept] partial_ordering::partial_ordering(std::partial_ordering stdorder)

Erstellt ein ` Qt::partial_ordering `-Objekt aus ` stdorder ` unter Anwendung der folgenden Regeln:

  • „std::partial_ordering::less“ wird in „ less “ konvertiert.
  • std::partial_ordering::equivalent wird in equivalent umgewandelt.
  • std::partial_ordering::greater wird in „ greater “ konvertiert.
  • std::partial_ordering::unordered wird konvertiert in unordered

[constexpr noexcept] partial_ordering::operator std::partial_ordering() const

Wandelt diesen Wert vom Typ „ Qt::partial_ordering “ unter Anwendung der folgenden Regeln in ein Objekt vom Typ „std::partial_ordering“ um:

  • less Wird in `std::partial_ordering::less` konvertiert.
  • equivalent Wird in `std::partial_ordering::equivalent` konvertiert.
  • greater Wird in std::partial_ordering::greater konvertiert.
  • unordered Wird in `std::partial_ordering::unordered` konvertiert.

Dokumentation zu den Member-Variablen

const Qt::partial_ordering partial_ordering::equivalent

Stellt das Ergebnis eines Vergleichs dar, bei dem die beiden Operanden gleich sind.

const Qt::partial_ordering partial_ordering::greater

Stellt das Ergebnis eines Vergleichs dar, bei dem der linke Operand größer ist als der rechte Operand.

const Qt::partial_ordering partial_ordering::less

Stellt das Ergebnis eines Vergleichs dar, bei dem der linke Operand kleiner ist als der rechte Operand.

const Qt::partial_ordering partial_ordering::unordered

Stellt das Ergebnis eines Vergleichs dar, bei dem zwischen den beiden Operanden keine Reihenfolgebeziehung besteht.

Verwandte Nicht-Mitglieder

[constexpr noexcept] bool is_eq(Qt::partial_ordering o)

[constexpr noexcept] bool is_gt(Qt::partial_ordering o)

[constexpr noexcept] bool is_gteq(Qt::partial_ordering o)

[constexpr noexcept] bool is_lt(Qt::partial_ordering o)

[constexpr noexcept] bool is_lteq(Qt::partial_ordering o)

[constexpr noexcept] bool is_neq(Qt::partial_ordering o)

Wandelt „ o “ in das Ergebnis eines der sechs relationalen Operatoren um:

FunktionOperation
is_eqo == 0
is_neqo != 0
is_lto < 0
is_lteqo <= 0
is_gto > 0
is_gteqo >= 0

Diese Funktionen werden aus Gründen der Kompatibilität mit „ std::partial_ordering “ bereitgestellt.

[constexpr noexcept] bool operator!=(Qt::partial_ordering lhs, Qt::partial_ordering rhs)

Gibt „true“ zurück, wenn lhs und rhs unterschiedliche Ergebnisse liefern; andernfalls wird „true“ zurückgegeben.

[constexpr noexcept] bool operator==(Qt::partial_ordering lhs, Qt::partial_ordering rhs)

Gibt „true“ zurück, wenn „ lhs “ und „ rhs “ dasselbe Ergebnis darstellen; andernfalls wird „false“ zurückgegeben.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.