Nesta página

Qt::partial_ordering Class

class Qt::partial_ordering

Qt::partial_ordering representa o resultado de uma comparação que permite resultados não ordenados. Mais...

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

Funções públicas

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

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

Descrição detalhada

Normalmente, uma função de comparação tripla retorna um valor do tipo ` Qt::partial_ordering `. Essa função compara dois objetos, determinando se eles estão ordenados e, em caso afirmativo, qual é a ordem entre eles. Ela utiliza esse tipo de retorno para indicar que a ordenação é parcial; ou seja, nem todos os pares de valores estão ordenados.

Qt::partial_ordering possui quatro valores, representados pelas seguintes constantes simbólicas:

  • less representa que o operando à esquerda é menor que o da direita;
  • equivalent representa que os dois operandos são equivalentes;
  • greater representa que o operando esquerdo é maior que o direito;
  • unordered representa que os dois operandos não estão ordenados.

Qt::partial_ordering é usado de forma idiomática comparando-se uma instância com um zero literal, por exemplo, assim:

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

Comparar ` Qt::partial_ordering::unordered ` com o zero literal sempre retorna um resultado ` false `.

Veja também ` Qt::strong_ordering`, ` Qt::weak_ordering` e Visão geral dos tipos de comparação.

Documentação das funções de membro

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

Cria um objeto ` Qt::partial_ordering ` a partir de ` stdorder `, utilizando as seguintes regras:

  • std::partial_ordering::less é convertido para less.
  • std::partial_ordering::equivalent é convertido para equivalent.
  • std::partial_ordering::greater é convertido em greater.
  • std::partial_ordering::unordered é convertido em unordered

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

Converte este valor ` Qt::partial_ordering ` em um objeto `std::partial_ordering` utilizando as seguintes regras:

  • less converte para std::partial_ordering::less.
  • equivalent converte para std::partial_ordering::equivalent.
  • greater converte para std::partial_ordering::greater.
  • unordered converte para std::partial_ordering::unordered.

Documentação das variáveis de membro

const Qt::partial_ordering partial_ordering::equivalent

Representa o resultado de uma comparação em que os dois operandos são equivalentes.

const Qt::partial_ordering partial_ordering::greater

Representa o resultado de uma comparação em que o operando da esquerda é maior que o operando da direita.

const Qt::partial_ordering partial_ordering::less

Representa o resultado de uma comparação em que o operando à esquerda é menor que o operando à direita.

const Qt::partial_ordering partial_ordering::unordered

Representa o resultado de uma comparação em que não há relação de ordem entre os dois operandos.

Não-membros 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)

Converte ` o ` no resultado de um dos seis operadores relacionais:

FunçãoOperação
is_eqo == 0
is_neqo != 0
is_lto < 0
is_lteqo <= 0
is_gto > 0
is_gteqo >= 0

Essas funções são fornecidas para garantir a compatibilidade com o ` std::partial_ordering`.

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

Retorna `true` se lhs e rhs representarem resultados diferentes; caso contrário, retorna `true`.

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

Retorna `true` se lhs e rhs representarem o mesmo resultado; caso contrário, retorna `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.