Qt::strong_ordering Class
class Qt::strong_orderingQt::strong_ordering indica un confronto in cui valori equivalenti non sono distinguibili. Per saperne di più...
| Intestazione: | #include <QtCompare> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
| A partire da: | Qt 6.7 |
Funzioni pubbliche
| strong_ordering(std::strong_ordering stdorder) | |
| operator Qt::partial_ordering() const | |
| operator Qt::weak_ordering() const | |
| operator std::strong_ordering() const |
Membri pubblici statici
| const Qt::strong_ordering | equal |
| const Qt::strong_ordering | equivalent |
| const Qt::strong_ordering | greater |
| const Qt::strong_ordering | less |
Elementi non membri correlati
| bool | is_eq(Qt::strong_ordering o) |
| bool | is_gt(Qt::strong_ordering o) |
| bool | is_gteq(Qt::strong_ordering o) |
| bool | is_lt(Qt::strong_ordering o) |
| bool | is_lteq(Qt::strong_ordering o) |
| bool | is_neq(Qt::strong_ordering o) |
| bool | operator!=(Qt::strong_ordering lhs, Qt::strong_ordering rhs) |
| bool | operator==(Qt::strong_ordering lhs, Qt::strong_ordering rhs) |
Descrizione dettagliata
Una funzione di confronto a tre vie restituisce in genere un valore di tipo ` Qt::strong_ordering `. Tale funzione confronta due oggetti e stabilisce il loro ordine. Utilizza questo tipo di ritorno per indicare che l'ordinamento è stretto; ovvero, la funzione stabilisce un ordine totale ben definito.
Qt::strong_ordering ha quattro valori, rappresentati dalle seguenti costanti simboliche:
- less indica che l'operando di sinistra è minore di quello di destra;
- equal indica che l’operando sinistro è equivalente a quello destro;
- equivalent è un alias per `
equal`; - greater indica che l’operando di sinistra è maggiore di quello di destra.
Qt::strong_ordering viene usato in modo idiomatico per confrontare un'istanza con uno zero letterale, ad esempio in questo modo:
// 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::strong_ordering compare(T lhs, T rhs); // defined out-of-line
~~~
Qt::strong_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
}Vedi anche Qt::weak_ordering, Qt::partial_ordering e Panoramica sui tipi di confronto.
Documentazione delle funzioni membro
[constexpr noexcept] strong_ordering::strong_ordering(std::strong_ordering stdorder)
Crea un oggetto ` Qt::strong_ordering ` a partire da ` stdorder ` utilizzando le seguenti regole:
- std::strong_ordering::less viene convertito in less.
- std::strong_ordering::equivalent viene convertito in equivalent.
- std::strong_ordering::equal viene convertito in equal.
- std::strong_ordering::greater viene convertito in greater.
[constexpr noexcept] strong_ordering::operator Qt::partial_ordering() const
Converte questo valore Qt::strong_ordering in un oggetto Qt::partial_ordering utilizzando le seguenti regole:
- less converte in Qt::partial_ordering::less.
- equivalent converte in Qt::partial_ordering::equivalent.
- equal converte in Qt::partial_ordering::equivalent.
- greater converte in Qt::partial_ordering::greater.
[constexpr noexcept] strong_ordering::operator Qt::weak_ordering() const
Converte il valore " Qt::strong_ordering " in un oggetto " Qt::weak_ordering " utilizzando le seguenti regole:
- less converte in Qt::weak_ordering::less.
- equivalent converte in Qt::weak_ordering::equivalent.
- equal converte in Qt::weak_ordering::equivalent.
- greater converte in Qt::weak_ordering::greater.
[constexpr noexcept] strong_ordering::operator std::strong_ordering() const
Converte questo valore di tipo ` Qt::strong_ordering ` in un oggetto di tipo `std::strong_ordering` utilizzando le seguenti regole:
- less converte in std::strong_ordering::less.
- equivalent converte in std::strong_ordering::equivalent.
- equal converte in std::strong_ordering::equal.
- greater converte in std::strong_ordering::greater.
Documentazione sulle variabili membro
const Qt::strong_ordering strong_ordering::equal
Rappresenta il risultato di un confronto in cui l'operando di sinistra è uguale a quello di destra. Equivalente a ` Qt::strong_ordering::equivalent`.
const Qt::strong_ordering strong_ordering::equivalent
Rappresenta il risultato di un confronto in cui l'operando di sinistra è uguale a quello di destra. Equivalente a ` Qt::strong_ordering::equal`.
const Qt::strong_ordering strong_ordering::greater
Rappresenta il risultato di un confronto in cui l'operando di sinistra è maggiore di quello di destra.
const Qt::strong_ordering strong_ordering::less
Indica il risultato di un confronto in cui l'operando di sinistra è minore dell'operando di destra.
Elementi correlati non membri
[constexpr noexcept] bool is_eq(Qt::strong_ordering o)
[constexpr noexcept] bool is_gt(Qt::strong_ordering o)
[constexpr noexcept] bool is_gteq(Qt::strong_ordering o)
[constexpr noexcept] bool is_lt(Qt::strong_ordering o)
[constexpr noexcept] bool is_lteq(Qt::strong_ordering o)
[constexpr noexcept] bool is_neq(Qt::strong_ordering o)
Converte un’ o e nel risultato di uno dei sei operatori relazionali:
| Funzione | Operazione |
|---|---|
is_eq | o == 0 |
is_neq | o != 0 |
is_lt | o < 0 |
is_lteq | o <= 0 |
is_gt | o > 0 |
is_gteq | o >= 0 |
Queste funzioni sono fornite per garantire la compatibilità con std::strong_ordering.
[constexpr noexcept] bool operator!=(Qt::strong_ordering lhs, Qt::strong_ordering rhs)
Restituisce true se lhs e rhs rappresentano risultati diversi; in caso contrario, restituisce true.
[constexpr noexcept] bool operator==(Qt::strong_ordering lhs, Qt::strong_ordering rhs)
Restituisce true se lhs e rhs corrispondono allo stesso risultato; in caso contrario, restituisce false.
© 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.