Qt::partial_ordering Class
class Qt::partial_orderingQt::partial_ordering représente le résultat d'une comparaison qui permet d'obtenir des résultats non ordonnés. 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
| partial_ordering(std::partial_ordering stdorder) | |
| operator std::partial_ordering() const |
Membres publics statiques
| const Qt::partial_ordering | equivalent |
| const Qt::partial_ordering | greater |
| const Qt::partial_ordering | less |
| const Qt::partial_ordering | unordered |
Non-membres apparentés
| 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) |
Description détaillée
Une valeur de type Qt::partial_ordering est généralement renvoyée par une fonction de comparaison à trois voies. Une telle fonction compare deux objets, en déterminant s'ils sont ordonnés et, le cas échéant, leur ordre. Elle utilise ce type de retour pour indiquer que l'ordre est partiel, c'est-à-dire que toutes les paires de valeurs ne sont pas ordonnées.
Qt::partial_ordering a quatre valeurs, représentées par les constantes symboliques suivantes :
- less représente que l'opérande de gauche est inférieur à celui de droite ;
- equivalent représente que les deux opérandes sont équivalents ;
- greater représente que l'opérande gauche est supérieur à l'opérande droit ;
- unordered représente que les deux opérandes ne sont pas ordonnés.
Qt::partial_ordering est utilisé de manière idiomatique en comparant une instance à un zéro littéral, par exemple de la manière suivante :
// 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 }
La comparaison de Qt::partial_ordering::unordered avec la valeur littérale 0 renvoie toujours le résultat false.
Voir également Qt::strong_ordering, Qt::weak_ordering, et Aperçu des types de comparaison.
Documentation sur les fonctions membres
[constexpr noexcept] partial_ordering::partial_ordering(std::partial_ordering stdorder)
Construit un objet Qt::partial_ordering à partir de stdorder en utilisant les règles suivantes :
- std::partial_ordering::less convertit en less.
- std::partial_ordering::equivalent convertit en equivalent.
- std::partial_ordering::greater convertit en greater.
- std::partial_ordering::unordered convertit en unordered
[constexpr noexcept] partial_ordering::operator std::partial_ordering() const
Convertit cette valeur Qt::partial_ordering en un objet std::partial_ordering en utilisant les règles suivantes :
- less convertit en std::partial_ordering::less.
- equivalent convertit en std::partial_ordering::equivalent.
- greater convertit en std::partial_ordering::greater.
- unordered convertit en std::partial_ordering::unordered.
Documentation des variables membres
const Qt::partial_ordering partial_ordering::equivalent
Représente le résultat d'une comparaison où les deux opérandes sont équivalents.
const Qt::partial_ordering partial_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::partial_ordering partial_ordering::less
Représente le résultat d'une comparaison où l'opérande de gauche est inférieur à l'opérande de droite.
const Qt::partial_ordering partial_ordering::unordered
Représente le résultat d'une comparaison où il n'y a pas de relation d'ordre entre les deux opérandes.
Non-membres apparentés
[constexpr noexcept] bool is_eq(Qt::partial_ordering o)
[constexpr noexcept] bool is_neq(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_gt(Qt::partial_ordering o)
[constexpr noexcept] bool is_gteq(Qt::partial_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::partial_ordering.
[constexpr noexcept] bool operator!=(Qt::partial_ordering lhs, Qt::partial_ordering rhs)
Retourne vrai si lhs et rhs représentent des résultats différents ; sinon, retourne vrai.
[constexpr noexcept] bool operator==(Qt::partial_ordering lhs, Qt::partial_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.