\inmodule QtCore \title Classes and helpers for defining comparison operators \keyword qtcompare
More...
|
constexpr bool | operator== (strong_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept |
|
constexpr bool | operator!= (strong_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept |
|
constexpr bool | operator< (strong_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept |
|
constexpr bool | operator<= (strong_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept |
|
constexpr bool | operator> (strong_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept |
|
constexpr bool | operator>= (strong_ordering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept |
|
constexpr bool | operator== (QtPrivate::CompareAgainstLiteralZero, strong_ordering rhs) noexcept |
|
constexpr bool | operator!= (QtPrivate::CompareAgainstLiteralZero, strong_ordering rhs) noexcept |
|
constexpr bool | operator< (QtPrivate::CompareAgainstLiteralZero, strong_ordering rhs) noexcept |
|
constexpr bool | operator<= (QtPrivate::CompareAgainstLiteralZero, strong_ordering rhs) noexcept |
|
constexpr bool | operator> (QtPrivate::CompareAgainstLiteralZero, strong_ordering rhs) noexcept |
|
constexpr bool | operator>= (QtPrivate::CompareAgainstLiteralZero, strong_ordering rhs) noexcept |
|
constexpr bool | operator== (strong_ordering lhs, strong_ordering rhs) noexcept |
| Returns true if lhs and rhs represent the same result; otherwise, returns false.
|
|
constexpr bool | operator!= (strong_ordering lhs, strong_ordering rhs) noexcept |
| Returns true if lhs and rhs represent different results; otherwise, returns true.
|
|
constexpr bool | operator== (strong_ordering lhs, partial_ordering rhs) noexcept |
|
constexpr bool | operator!= (strong_ordering lhs, partial_ordering rhs) noexcept |
|
constexpr bool | operator== (partial_ordering lhs, strong_ordering rhs) noexcept |
|
constexpr bool | operator!= (partial_ordering lhs, strong_ordering rhs) noexcept |
|
constexpr bool | operator== (strong_ordering lhs, weak_ordering rhs) noexcept |
|
constexpr bool | operator!= (strong_ordering lhs, weak_ordering rhs) noexcept |
|
constexpr bool | operator== (weak_ordering lhs, strong_ordering rhs) noexcept |
|
constexpr bool | operator!= (weak_ordering lhs, strong_ordering rhs) noexcept |
|
QT_WARNING_PUSH friend constexpr bool | is_eq (strong_ordering o) noexcept |
|
constexpr bool | is_neq (strong_ordering o) noexcept |
|
constexpr bool | is_lt (strong_ordering o) noexcept |
|
constexpr bool | is_lteq (strong_ordering o) noexcept |
|
constexpr bool | is_gt (strong_ordering o) noexcept |
|
constexpr bool | is_gteq (strong_ordering o) noexcept |
|
\inmodule QtCore \title Classes and helpers for defining comparison operators \keyword qtcompare
The <QtCompare> header file defines {Qt:
:*_ordering} types and helper macros for defining comparison operators.
This header introduces the \l Qt::partial_ordering, \l Qt::weak_ordering, and \l Qt::strong_ordering types, which are Qt's C++17 backports of {std:
:*_ordering} types.
This header also contains functions for implementing three-way comparison in C++17.
The {Qt::compareThreeWay()}
function overloads provide three-way comparison for built-in C++ types.
The \l qCompareThreeWay() template serves as a generic three-way comparison implementation. It relies on {Qt::compareThreeWay()}
and free {compareThreeWay()}
functions in its implementation.
\inmodule QtCore \inheaderfile QtCompare
Qt::strong_ordering represents a comparison where equivalent values are indistinguishable.
- See also
- Qt::weak_ordering, Qt::partial_ordering, {Comparison types overview}
- Since
- 6.7
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:
\list
- \l less represents that the left operand is less than the right;
- \l equal represents that the left operand is equivalent to the right;
- \l equivalent is an alias for
equal
;
- \l greater represents that the left operand is greater than the right. \endlist
Qt::strong_ordering is idiomatically used by comparing an instance against a literal zero, for instance like this:
~~~
}
}
\inmodule QtCore \title Classes and helpers for defining comparison operators \keyword qtcompare
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
static int compare(quint64 a, quint64 b)
Definition at line 441 of file qcompare.h.