partial_ordering Class

class Qt::partial_ordering

Qt::partial_ordering stellt das Ergebnis eines Vergleichs dar, der ungeordnete Ergebnisse zulässt. Mehr...

Kopfzeile: #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)
std::partial_ordering 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)

Detaillierte Beschreibung

Ein Wert vom Typ Qt::partial_ordering wird in der Regel von einer Drei-Wege-Vergleichsfunktion zurückgegeben. Eine solche Funktion vergleicht zwei Objekte und stellt fest, ob sie geordnet sind und wenn ja, in welcher Reihenfolge. Sie verwendet diesen Rückgabetyp, um anzuzeigen, dass die Ordnung partiell ist, d. h. 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 steht dafür, dass die beiden Operanden gleichwertig sind;
  • greater steht dafür, dass der linke Operand größer ist als der rechte;
  • unordered steht dafür, dass die beiden Operanden nicht geordnet sind.

Qt::partial_ordering wird idiomatisch verwendet, indem man eine Instanz mit einem Null-Literal vergleicht, z. B. wie folgt:

// 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 Vergleichstypen Übersicht.

Dokumentation der Mitgliedsfunktionen

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

Konstruiert ein Qt::partial_ordering Objekt aus stdorder unter Anwendung der folgenden Regeln:

  • std::partial_ordering::less konvertiert in less.
  • std::partial_ordering::equivalent wandelt in equivalent um.
  • std::partial_ordering::greater wandelt in greater um.
  • std::partial_ordering::unordered konvertiert zu unordered

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

Konvertiert diesen Qt::partial_ordering Wert in ein std::partial_ordering Objekt unter Anwendung der folgenden Regeln:

  • less konvertiert in std::partial_ordering::less.
  • equivalent konvertiert nach std::partial_ordering::equivalent.
  • greater konvertiert nach std::partial_ordering::greater.
  • unordered konvertiert nach std::partial_ordering::unordered.

Dokumentation der Mitgliedsvariablen

const Qt::partial_ordering partial_ordering::equivalent

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

const Qt::partial_ordering partial_ordering::greater

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

const Qt::partial_ordering partial_ordering::less

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

const Qt::partial_ordering partial_ordering::unordered

Stellt das Ergebnis eines Vergleichs dar, bei dem es keine Ordnungsbeziehung zwischen den beiden Operanden gibt.

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)

Konvertiert o in das Ergebnis eines der sechs relationalen Operatoren:

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 darstellen; 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 das gleiche Ergebnis darstellen; andernfalls wird false zurückgegeben.

© 2025 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.