weak_ordering Class
class Qt::weak_orderingQt::weak_ordering steht für einen Vergleich, bei dem gleichwertige Werte noch unterscheidbar sind. 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
weak_ordering(std::weak_ordering stdorder) | |
Qt::partial_ordering | operator Qt::partial_ordering() const |
std::weak_ordering | operator std::weak_ordering() const |
Statische öffentliche Mitglieder
const Qt::weak_ordering | equivalent |
const Qt::weak_ordering | greater |
const Qt::weak_ordering | less |
Verwandte Nicht-Mitglieder
bool | is_eq(Qt::weak_ordering o) |
bool | is_gt(Qt::weak_ordering o) |
bool | is_gteq(Qt::weak_ordering o) |
bool | is_lt(Qt::weak_ordering o) |
bool | is_lteq(Qt::weak_ordering o) |
bool | is_neq(Qt::weak_ordering o) |
bool | operator!=(Qt::weak_ordering lhs, Qt::weak_ordering rhs) |
bool | operator==(Qt::weak_ordering lhs, Qt::weak_ordering rhs) |
Detaillierte Beschreibung
Ein Wert vom Typ Qt::weak_ordering wird in der Regel von einer Drei-Wege-Vergleichsfunktion zurückgegeben. Eine solche Funktion vergleicht zwei Objekte und stellt fest, wie sie geordnet sind. Sie verwendet diesen Rückgabetyp, um anzuzeigen, dass die Ordnung schwach ist, d. h., dass gleichwertige Werte unterscheidbar sein können.
Qt::weak_ordering hat drei 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 der linke Operand gleich dem rechten ist;
- greater steht dafür, dass der linke Operand größer ist als der rechte,
Qt::weak_ordering wird idiomatisch verwendet, indem eine Instanz mit einer literalen Null verglichen wird, z. B. 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::weak_ordering compare(T lhs, T rhs); // defined out-of-line ~~~ Qt::weak_ordering result = compare(a, b); if (result < 0) { // a is less than b } if (compare(c, d) >= 0) { // c is greater than or equivalent to d }
Siehe auch Qt::strong_ordering, Qt::partial_ordering, und Übersicht über Vergleichstypen.
Dokumentation der Mitgliedsfunktionen
[constexpr noexcept]
weak_ordering::weak_ordering(std::weak_ordering stdorder)
Konstruiert ein Qt::weak_ordering Objekt aus stdorder unter Verwendung der folgenden Regeln:
- std::weak_ordering::less konvertiert in less.
- std::weak_ordering::equivalent wandelt in equivalent um.
- std::weak_ordering::greater wandelt in greater um.
[constexpr noexcept]
Qt::partial_ordering weak_ordering::operator Qt::partial_ordering() const
Konvertiert diesen Qt::weak_ordering Wert in ein Qt::partial_ordering Objekt unter Verwendung der folgenden Regeln:
- less konvertiert in Qt::partial_ordering::less.
- equivalent konvertiert nach Qt::partial_ordering::equivalent.
- greater konvertiert in Qt::partial_ordering::greater.
[constexpr noexcept]
std::weak_ordering weak_ordering::operator std::weak_ordering() const
Konvertiert diesen Wert Qt::weak_ordering in ein std::weak_ordering-Objekt unter Anwendung der folgenden Regeln:
- less konvertiert in std::weak_ordering::less.
- equivalent konvertiert nach std::weak_ordering::equivalent.
- greater konvertiert nach std::weak_ordering::greater.
Dokumentation der Mitgliedsvariablen
const Qt::weak_ordering weak_ordering::equivalent
Stellt das Ergebnis eines Vergleichs dar, bei dem der linke Operand dem rechten Operanden entspricht.
const Qt::weak_ordering weak_ordering::greater
Stellt das Ergebnis eines Vergleichs dar, bei dem der linke Operand größer als der rechte Operand ist.
const Qt::weak_ordering weak_ordering::less
Stellt das Ergebnis eines Vergleichs dar, bei dem der linke Operand kleiner als der rechte Operand ist.
Verwandte Nicht-Mitglieder
[constexpr noexcept]
bool is_eq(Qt::weak_ordering o)
[constexpr noexcept]
bool is_gt(Qt::weak_ordering o)
[constexpr noexcept]
bool is_gteq(Qt::weak_ordering o)
[constexpr noexcept]
bool is_lt(Qt::weak_ordering o)
[constexpr noexcept]
bool is_lteq(Qt::weak_ordering o)
[constexpr noexcept]
bool is_neq(Qt::weak_ordering o)
Konvertiert o in das Ergebnis eines der sechs relationalen Operatoren:
Funktion | Operation |
---|---|
is_eq | o == 0 |
is_neq | o != 0 |
is_lt | o < 0 |
is_lteq | o <= 0 |
is_gt | o > 0 |
is_gteq | o >= 0 |
Diese Funktionen werden aus Gründen der Kompatibilität mit std::weak_ordering
bereitgestellt.
[constexpr noexcept]
bool operator!=(Qt::weak_ordering lhs, Qt::weak_ordering rhs)
Gibt true zurück, wenn lhs und rhs unterschiedliche Ergebnisse darstellen; andernfalls wird true zurückgegeben.
[constexpr noexcept]
bool operator==(Qt::weak_ordering lhs, Qt::weak_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.