En esta página

Qt::partial_ordering Class

class Qt::partial_ordering

Qt::partial_ordering representa el resultado de una comparación que permite resultados desordenados. Más...

Cabecera: #include <QtCompare>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Desde: Qt 6.7

Funciones Públicas

partial_ordering(std::partial_ordering stdorder)
operator std::partial_ordering() const

Miembros públicos estáticos

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)

Descripción detallada

Un valor de tipo Qt::partial_ordering es típicamente devuelto por una función de comparación tripartita. Dicha función compara dos objetos, estableciendo si están ordenados y, en caso afirmativo, su orden. Utiliza este tipo de retorno para indicar que la ordenación es parcial, es decir, que no todos los pares de valores están ordenados.

Qt::partial_ordering tiene cuatro valores, representados por las siguientes constantes simbólicas:

  • less representa que el operando de la izquierda es menor que el de la derecha;
  • equivalent representa que los dos operandos son equivalentes;
  • greater representa que el operando izquierdo es mayor que el derecho;
  • unordered representa que los dos operandos no están ordenados.

Qt::partial_ordering se utiliza idiomáticamente comparando una instancia contra un cero literal, por ejemplo así:

// 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
}

Comparando Qt::partial_ordering::unordered contra el literal 0 siempre devuelve un resultado false.

Véase también Qt::strong_ordering, Qt::weak_ordering, y Visión general de los tipos de comparación.

Documentación de funciones miembro

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

Construye un objeto Qt::partial_ordering a partir de stdorder utilizando las siguientes reglas:

  • std::partial_ordering::less convierte a less.
  • std::partial_ordering::equivalent convierte a equivalent.
  • std::partial_ordering::greater convierte a greater.
  • std::partial_ordering::unordered se convierte en unordered

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

Convierte este valor Qt::partial_ordering en un objeto std::partial_ordering utilizando las siguientes reglas:

  • less convierte a std::partial_ordering::less.
  • equivalent convierte a std::ordenación_parcial::equivalente.
  • greater convierte a std::ordenación_parcial::mayor.
  • unordered convierte a std::ordenación_parcial::desordenada.

Documentación de variables miembro

const Qt::partial_ordering partial_ordering::equivalent

Representa el resultado de una comparación en la que los dos operandos son equivalentes.

const Qt::partial_ordering partial_ordering::greater

Representa el resultado de una comparación en la que el operando izquierdo es mayor que el operando derecho.

const Qt::partial_ordering partial_ordering::less

Representa el resultado de una comparación en la que el operando izquierdo es menor que el operando derecho.

const Qt::partial_ordering partial_ordering::unordered

Representa el resultado de una comparación en la que no existe relación de orden entre los dos operandos.

No miembros relacionados

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

Convierte o en el resultado de uno de los seis operadores relacionales:

FunciónOperación
is_eqo == 0
is_neqo != 0
is_lto < 0
is_lteqo <= 0
is_gto > 0
is_gteqo >= 0

Estas funciones se proporcionan por compatibilidad con std::partial_ordering.

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

Devuelve true si lhs y rhs representan resultados diferentes; en caso contrario, devuelve true.

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

Devuelve true si lhs y rhs representan el mismo resultado; en caso contrario, devuelve 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.