Qt::strong_ordering Class
class Qt::strong_orderingQt::strong_ordering représente une comparaison où des valeurs équivalentes sont indiscernables. Plus d'informations...
| En-tête : | #include <QtCompare> |
| CMake : | find_package(Qt6 REQUIRED COMPONENTS Core)target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake : | QT += core |
| Depuis : | Qt 6.7 |
Fonctions publiques
| strong_ordering(std::strong_ordering stdorder) | |
| operator Qt::partial_ordering() const | |
| operator Qt::weak_ordering() const | |
| operator std::strong_ordering() const |
Membres publics statiques
| const Qt::strong_ordering | equal |
| const Qt::strong_ordering | equivalent |
| const Qt::strong_ordering | greater |
| const Qt::strong_ordering | less |
Non-membres apparentés
| 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) |
Description détaillée
Une valeur de type Qt::strong_ordering est généralement renvoyée par une fonction de comparaison à trois voies. Une telle fonction compare deux objets et détermine leur ordre. Elle utilise ce type de retour pour indiquer que l'ordre est strict, c'est-à-dire que la fonction établit un ordre total bien défini.
Qt::strong_ordering a quatre valeurs, représentées par les constantes symboliques suivantes :
- less représente que l'opérande gauche est inférieur à l'opérande droit ;
- equal représente que l'opérande gauche est équivalent à l'opérande droit ;
- equivalent est un alias de
equal; - greater représente que l'opérande gauche est supérieur à l'opérande droit.
Qt::strong_ordering est utilisé de manière idiomatique en comparant une instance à un zéro littéral, par exemple comme ceci :
// 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 }
Voir également Qt::weak_ordering, Qt::partial_ordering, et Aperçu des types de comparaison.
Documentation sur les fonctions membres
[constexpr noexcept] strong_ordering::strong_ordering(std::strong_ordering stdorder)
Construit un objet Qt::strong_ordering à partir de stdorder en utilisant les règles suivantes :
- std::strong_ordering::less convertit en less.
- std::strong_ordering::equivalent convertit en equivalent.
- std::strong_ordering::equal convertit en equal.
- std::strong_ordering::greater convertit en greater.
[constexpr noexcept] strong_ordering::operator Qt::partial_ordering() const
Convertit cette valeur Qt::strong_ordering en un objet Qt::partial_ordering en utilisant les règles suivantes :
- less convertit en Qt::partial_ordering::less.
- equivalent convertit en Qt::partial_ordering::equivalent.
- equal convertit en Qt::partial_ordering::equivalent.
- greater convertit en Qt::partial_ordering::greater.
[constexpr noexcept] strong_ordering::operator Qt::weak_ordering() const
Convertit cette valeur Qt::strong_ordering en un objet Qt::weak_ordering en utilisant les règles suivantes :
- less convertit en Qt::weak_ordering::less.
- equivalent convertit en Qt::weak_ordering::equivalent.
- equal convertit en Qt::weak_ordering::equivalent.
- greater convertit en Qt::weak_ordering::greater.
[constexpr noexcept] strong_ordering::operator std::strong_ordering() const
Convertit cette valeur Qt::strong_ordering en un objet std::strong_ordering en utilisant les règles suivantes :
- less convertit en std::strong_ordering::less.
- equivalent convertit en std::strong_ordering::equivalent.
- equal convertit en std::strong_ordering::equal.
- greater convertit en std::strong_ordering::greater.
Documentation des variables membres
const Qt::strong_ordering strong_ordering::equal
Représente le résultat d'une comparaison où l'opérande gauche est égal à l'opérande droit. Identique à Qt::strong_ordering::equivalent.
const Qt::strong_ordering strong_ordering::equivalent
Représente le résultat d'une comparaison où l'opérande gauche est égal à l'opérande droit. Identique à Qt::strong_ordering::equal.
const Qt::strong_ordering strong_ordering::greater
Représente le résultat d'une comparaison où l'opérande de gauche est plus grand que l'opérande de droite.
const Qt::strong_ordering strong_ordering::less
Représente le résultat d'une comparaison où l'opérande de gauche est inférieur à l'opérande de droite.
Non-membres apparentés
[constexpr noexcept] bool is_eq(Qt::strong_ordering o)
[constexpr noexcept] bool is_neq(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_gt(Qt::strong_ordering o)
[constexpr noexcept] bool is_gteq(Qt::strong_ordering o)
Convertit o en résultat de l'un des six opérateurs relationnels :
| Fonction | Opération |
|---|---|
is_eq | o == 0 |
is_neq | o != 0 |
is_lt | o < 0 |
is_lteq | o <= 0 |
is_gt | o > 0 |
is_gteq | o >= 0 |
Ces fonctions sont fournies à des fins de compatibilité avec std::strong_ordering.
[constexpr noexcept] bool operator!=(Qt::strong_ordering lhs, Qt::strong_ordering rhs)
Retourne vrai si lhs et rhs représentent des résultats différents ; sinon, retourne vrai.
[constexpr noexcept] bool operator==(Qt::strong_ordering lhs, Qt::strong_ordering rhs)
Retourne vrai si lhs et rhs représentent le même résultat ; sinon, retourne faux.
© 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.