Qt::partial_ordering Class
class Qt::partial_orderingQt::partial_ordering representa el resultado de una comparación que admite resultados sin ordenar. Más...
| Encabezado: | #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 |
Elementos no miembros relacionados
| 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
Normalmente, una función de comparación de tres vías devuelve un valor de tipo ` Qt::partial_ordering `. Dicha función compara dos objetos, determinando si están ordenados y, en caso afirmativo, cuál es su orden. Utiliza este tipo de retorno para indicar que el orden 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 indica que el operando de la izquierda es menor que el de la derecha;
- equivalent indica que los dos operandos son equivalentes;
- greater indica que el operando de la izquierda es mayor que el de la derecha;
- unordered indica que los dos operandos no están ordenados.
Qt::partial_ordering Se utiliza de forma habitual comparando una instancia con 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
}La comparación de ` Qt::partial_ordering::unordered ` con el 0 literal siempre devuelve un resultado ` false `.
Véase también « Qt::strong_ordering », « Qt::weak_ordering » y la «Descripción general de los tipos de comparación».
Documentación de funciones miembro
[constexpr noexcept] partial_ordering::partial_ordering(std::partial_ordering stdorder)
Crea un objeto ` Qt::partial_ordering ` a partir de ` stdorder ` siguiendo las siguientes reglas:
- std::partial_ordering::less se convierte en less.
- std::partial_ordering::equivalent se convierte en equivalent.
- std::partial_ordering::greater se convierte en greater.
- std::partial_ordering::unordered se convierte en unordered
[constexpr noexcept] partial_ordering::operator std::partial_ordering() const
Convierte este valor de ` Qt::partial_ordering ` en un objeto `std::partial_ordering` siguiendo las siguientes reglas:
- less se convierte en std::partial_ordering::less.
- equivalent se convierte en std::partial_ordering::equivalent.
- greater se convierte a `std::partial_ordering::greater`.
- unordered se convierte en std::partial_ordering::unordered.
Documentación de las 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 de la izquierda es mayor que el de la derecha.
const Qt::partial_ordering partial_ordering::less
Representa el resultado de una comparación en la que el operando de la izquierda es menor que el de la derecha.
const Qt::partial_ordering partial_ordering::unordered
Representa el resultado de una comparación en la que no existe ninguna relación de orden entre los dos operandos.
Elementos no miembros relacionados
[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)
Convierte ` o ` en el resultado de uno de los seis operadores relacionales:
| Función | Operación |
|---|---|
is_eq | o == 0 |
is_neq | o != 0 |
is_lt | o < 0 |
is_lteq | o <= 0 |
is_gt | o > 0 |
is_gteq | o >= 0 |
Estas funciones se proporcionan para garantizar la compatibilidad con std::partial_ordering.
[constexpr noexcept] bool operator!=(Qt::partial_ordering lhs, Qt::partial_ordering rhs)
Devuelve «true» si lhs y rhs muestran 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.