Qt::strong_ordering represents a comparison where equivalent values are indistinguishable. More...
| Header: | #include <QtCompare> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core)target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
| Since: | Qt 6.7 |
| strong_ordering(std::strong_ordering stdorder) | |
| Qt::partial_ordering | operator Qt::partial_ordering() const |
| Qt::weak_ordering | operator Qt::weak_ordering() const |
| std::strong_ordering | operator std::strong_ordering() const |
| const Qt::strong_ordering | equal |
| const Qt::strong_ordering | equivalent |
| const Qt::strong_ordering | greater |
| const Qt::strong_ordering | less |
| bool | is_eq(Qt::strong_ordering o) |
| bool | is_gt(Qt::strong_ordering o) |
| bool | is_gteq(Qt::strong_ordering o) |
| bool | is_lt(Qt::strong_ordering o) |
| bool | is_lteq(Qt::strong_ordering o) |
| bool | is_neq(Qt::strong_ordering o) |
| bool | operator!=(Qt::strong_ordering lhs, Qt::strong_ordering rhs) |
| bool | operator==(Qt::strong_ordering lhs, Qt::strong_ordering rhs) |
A value of type Qt::strong_ordering is typically returned from a three-way comparison function. Such a function compares two objects and establishes how they are ordered. It uses this return type to indicate that the ordering is strict; that is, the function establishes a well-defined total order.
Qt::strong_ordering has four values, represented by the following symbolic constants:
equal;
Qt::strong_ordering is idiomatically used by comparing an instance against a literal zero, for instance like this:
// 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::strong_ordering compare(T lhs, T rhs); // defined out-of-line ~~~ Qt::strong_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 }
See also Qt::weak_ordering, Qt::partial_ordering, and Comparison types overview.
[constexpr noexcept] strong_ordering::strong_ordering(std::strong_ordering
stdorder)Constructs a Qt::strong_ordering object from stdorder using the following rules:
[constexpr noexcept] Qt::partial_ordering strong_ordering::operator Qt::partial_ordering() constConverts this Qt::strong_ordering value to a Qt::partial_ordering object using the following rules:
[constexpr noexcept] Qt::weak_ordering
strong_ordering::operator Qt::weak_ordering() constConverts this Qt::strong_ordering value to a Qt::weak_ordering object using the following rules:
[constexpr noexcept] std::strong_ordering strong_ordering::operator std::strong_ordering() constConverts this Qt::strong_ordering value to a std::strong_ordering object using the following rules:
Represents the result of a comparison where the left operand is equal to the right operand. Same as Qt::strong_ordering::equivalent.
Represents the result of a comparison where the left operand is equal to the right operand. Same as Qt::strong_ordering::equal.
Represents the result of a comparison where the left operand is greater than the right operand.
Represents the result of a comparison where the left operand is less than the right operand.
[constexpr noexcept] bool is_eq(Qt::strong_ordering o)[constexpr noexcept] bool is_gt(Qt::strong_ordering o)[constexpr noexcept] bool is_gteq(Qt::strong_ordering o)[constexpr noexcept] bool is_lt(Qt::strong_ordering o)[constexpr noexcept] bool is_lteq(Qt::strong_ordering o)[constexpr noexcept] bool is_neq(Qt::strong_ordering o)Converts o into the result of one of the six relational operators:
| Function | Operation |
|---|---|
is_eq |
o == 0 |
is_neq |
o != 0 |
is_lt |
o < 0 |
is_lteq |
o <= 0 |
is_gt |
o > 0 |
is_gteq |
o >= 0 |
These functions are provided for compatibility with std::strong_ordering.
[constexpr noexcept] bool operator!=(Qt::strong_ordering lhs, Qt::strong_ordering rhs)Returns true if lhs and rhs represent different results; otherwise, returns true.
[constexpr noexcept] bool operator==(Qt::strong_ordering lhs, Qt::strong_ordering rhs)Returns true if lhs and rhs represent the same result; otherwise, returns false.