Sur cette page

Qt::partial_ordering Class

class Qt::partial_ordering

Qt::partial_ordering représente le résultat d'une comparaison pouvant donner lieu à des résultats non classés. En savoir plus...

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
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 fonction de comparaison à trois voies renvoie généralement une valeur de type ` Qt::partial_ordering `. Une telle fonction compare deux objets afin de déterminer 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 Il existe quatre valeurs, représentées par les constantes symboliques suivantes :

  • less indique que l’opérande de gauche est inférieur à celui de droite ;
  • equivalent indique que les deux opérandes sont équivalents ;
  • greater indique que l’opérande de gauche est supérieur à celui de droite ;
  • unordered indique que les deux opérandes ne sont pas ordonnés.

Qt::partial_ordering est couramment utilisé 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::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 le zéro littéral renvoie toujours un résultat de type ` false `.

Voir également Qt::strong_ordering, Qt::weak_ordering et la présentation des types de comparaison.

Documentation sur les fonctions membres

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

Crée un objet ` Qt::partial_ordering ` à partir de ` stdorder ` en appliquant les règles suivantes :

  • std::partial_ordering::less se convertit en less.
  • std::partial_ordering::equivalent est converti en equivalent.
  • std::partial_ordering::greater est converti en greater.
  • std::partial_ordering::unordered se convertit en unordered

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

Convertit cette valeur de type ` Qt::partial_ordering ` en un objet `std::partial_ordering` selon les règles suivantes :

  • less se 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 sur les variables membres

const Qt::partial_ordering partial_ordering::equivalent

Représente le résultat d'une comparaison dans laquelle les deux opérandes sont équivalents.

const Qt::partial_ordering partial_ordering::greater

Représente le résultat d'une comparaison dans laquelle l'opérande de gauche est supérieur à l'opérande de droite.

const Qt::partial_ordering partial_ordering::less

Représente le résultat d'une comparaison dans laquelle 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 dans laquelle il n'existe aucune relation d'ordre entre les deux opérandes.

Éléments non membres associés

[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)

Convertit une expression de type « o » en le résultat de l'un des six opérateurs relationnels suivants :

FonctionOpération
is_eqo == 0
is_neqo != 0
is_lto < 0
is_lteqo <= 0
is_gto > 0
is_gteqo >= 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)

Renvoie « true » si lhs et rhs renvoient des résultats différents ; sinon, renvoie « true ».

[constexpr noexcept] bool operator==(Qt::partial_ordering lhs, Qt::partial_ordering rhs)

Renvoie « true » si lhs et rhs correspondent au même résultat ; sinon, renvoie « 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.