Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QPartialOrdering Class Reference

\variable Qt::partial_ordering::less More...

#include <qcompare.h>

Collaboration diagram for QPartialOrdering:

Public Member Functions

constexpr Q_IMPLICIT QPartialOrdering (Qt::partial_ordering order) noexcept
constexpr Q_IMPLICIT QPartialOrdering (Qt::weak_ordering stdorder) noexcept
constexpr Q_IMPLICIT QPartialOrdering (Qt::strong_ordering stdorder) noexcept
constexpr Q_IMPLICIT operator Qt::partial_ordering () const noexcept

Static Public Attributes

static const QPartialOrdering Less
static const QPartialOrdering Equivalent
static const QPartialOrdering Greater
static const QPartialOrdering Unordered
static const QPartialOrdering less
static const QPartialOrdering equivalent
static const QPartialOrdering greater
static const QPartialOrdering unordered

Friends

constexpr bool operator== (QPartialOrdering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept
constexpr bool operator!= (QPartialOrdering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept
constexpr bool operator< (QPartialOrdering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept
constexpr bool operator<= (QPartialOrdering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept
constexpr bool operator> (QPartialOrdering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept
constexpr bool operator>= (QPartialOrdering lhs, QtPrivate::CompareAgainstLiteralZero) noexcept
constexpr bool operator== (QtPrivate::CompareAgainstLiteralZero, QPartialOrdering rhs) noexcept
constexpr bool operator!= (QtPrivate::CompareAgainstLiteralZero, QPartialOrdering rhs) noexcept
constexpr bool operator< (QtPrivate::CompareAgainstLiteralZero, QPartialOrdering rhs) noexcept
constexpr bool operator<= (QtPrivate::CompareAgainstLiteralZero, QPartialOrdering rhs) noexcept
constexpr bool operator> (QtPrivate::CompareAgainstLiteralZero, QPartialOrdering rhs) noexcept
constexpr bool operator>= (QtPrivate::CompareAgainstLiteralZero, QPartialOrdering rhs) noexcept
constexpr bool operator== (QPartialOrdering lhs, QPartialOrdering rhs) noexcept
 Return true if lhs and rhs represent the same result; otherwise, returns false.
constexpr bool operator!= (QPartialOrdering lhs, QPartialOrdering rhs) noexcept
 Return true if lhs and rhs represent different results; otherwise, returns true.
constexpr bool operator== (QPartialOrdering lhs, Qt::partial_ordering rhs) noexcept
constexpr bool operator!= (QPartialOrdering lhs, Qt::partial_ordering rhs) noexcept
constexpr bool operator== (Qt::partial_ordering lhs, QPartialOrdering rhs) noexcept
constexpr bool operator!= (Qt::partial_ordering lhs, QPartialOrdering rhs) noexcept
QT_WARNING_PUSH friend constexpr bool is_eq (QPartialOrdering o) noexcept
constexpr bool is_neq (QPartialOrdering o) noexcept
constexpr bool is_lt (QPartialOrdering o) noexcept
constexpr bool is_lteq (QPartialOrdering o) noexcept
constexpr bool is_gt (QPartialOrdering o) noexcept
constexpr bool is_gteq (QPartialOrdering o) noexcept

Detailed Description

\variable Qt::partial_ordering::less

Represents the result of a comparison where the left operand is less than the right operand.

\variable Qt::partial_ordering::equivalent

Represents the result of a comparison where the two operands are equivalent.

\variable Qt::partial_ordering::greater

Represents the result of a comparison where the left operand is greater than the right operand.

\variable Qt::partial_ordering::unordered

Represents the result of a comparison where there is no ordering relationship between the two operands.

\inmodule QtCore

QPartialOrdering represents the result of a comparison that allows for unordered results.

See also
Qt::strong_ordering, Qt::weak_ordering, {Comparison types overview}
Since
6.0

A value of type QPartialOrdering is typically returned from a three-way comparison function. Such a function compares two objects, establishing whether they are ordered and, if so, their ordering. It uses this return type to indicate that the ordering is partial; that is, not all pairs of values are ordered.

QPartialOrdering has four values, represented by the following symbolic constants:

\list

  • \l less represents that the left operand is less than the right;
  • \l equivalent represents that the two operands are equivalent;
  • \l greater represents that the left operand is greater than the right;
  • \l unordered represents that the two operands are {not ordered}. \endlist

QPartialOrdering 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:
QPartialOrdering compare(T lhs, T rhs); // defined out-of-line
~~~
QPartialOrdering 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
}
constexpr Q_IMPLICIT QPartialOrdering(Qt::partial_ordering order) noexcept
Definition qcompare.h:826
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
const GLubyte * c
GLuint64EXT * result
[6]
static int compare(quint64 a, quint64 b)

Comparing QPartialOrdering::unordered against literal 0 always returns a false result.

Definition at line 746 of file qcompare.h.

Constructor & Destructor Documentation

◆ QPartialOrdering() [1/3]

Q_IMPLICIT QPartialOrdering::QPartialOrdering ( Qt::partial_ordering order)
inlineconstexprnoexcept

Definition at line 826 of file qcompare.h.

◆ QPartialOrdering() [2/3]

Q_IMPLICIT QPartialOrdering::QPartialOrdering ( Qt::weak_ordering stdorder)
inlineconstexprnoexcept

Definition at line 837 of file qcompare.h.

◆ QPartialOrdering() [3/3]

Q_IMPLICIT QPartialOrdering::QPartialOrdering ( Qt::strong_ordering stdorder)
inlineconstexprnoexcept

Definition at line 840 of file qcompare.h.

Member Function Documentation

◆ operator Qt::partial_ordering()

Q_IMPLICIT QPartialOrdering::operator Qt::partial_ordering ( ) const
inlineconstexprnoexcept

Definition at line 843 of file qcompare.h.

◆ is_eq

QT_WARNING_PUSH friend constexpr bool is_eq ( QPartialOrdering o)
friend

Definition at line 923 of file qcompare.h.

◆ is_gt

bool is_gt ( QPartialOrdering o)
friend

Definition at line 927 of file qcompare.h.

◆ is_gteq

bool is_gteq ( QPartialOrdering o)
friend
Since
6.7
is_eq_table

These functions are provided for compatibility with {std::partial_ordering}.

Definition at line 928 of file qcompare.h.

◆ is_lt

bool is_lt ( QPartialOrdering o)
friend

Definition at line 925 of file qcompare.h.

◆ is_lteq

bool is_lteq ( QPartialOrdering o)
friend

Definition at line 926 of file qcompare.h.

◆ is_neq

bool is_neq ( QPartialOrdering o)
friend

Definition at line 924 of file qcompare.h.

◆ operator!= [1/5]

bool operator!= ( QPartialOrdering lhs,
QPartialOrdering rhs )
friend

Return true if lhs and rhs represent different results; otherwise, returns true.

Definition at line 823 of file qcompare.h.

◆ operator!= [2/5]

bool operator!= ( QPartialOrdering lhs,
Qt::partial_ordering rhs )
friend

Definition at line 865 of file qcompare.h.

References Qt::partial_ordering::operator!=.

◆ operator!= [3/5]

bool operator!= ( QPartialOrdering lhs,
QtPrivate::CompareAgainstLiteralZero  )
friend

Definition at line 763 of file qcompare.h.

◆ operator!= [4/5]

bool operator!= ( Qt::partial_ordering lhs,
QPartialOrdering rhs )
friend

Definition at line 871 of file qcompare.h.

References Qt::partial_ordering::operator!=.

◆ operator!= [5/5]

bool operator!= ( QtPrivate::CompareAgainstLiteralZero ,
QPartialOrdering rhs )
friend

Definition at line 788 of file qcompare.h.

◆ operator< [1/2]

bool operator< ( QPartialOrdering lhs,
QtPrivate::CompareAgainstLiteralZero  )
friend

Definition at line 767 of file qcompare.h.

◆ operator< [2/2]

bool operator< ( QtPrivate::CompareAgainstLiteralZero ,
QPartialOrdering rhs )
friend

Definition at line 792 of file qcompare.h.

◆ operator<= [1/2]

bool operator<= ( QPartialOrdering lhs,
QtPrivate::CompareAgainstLiteralZero  )
friend

Definition at line 771 of file qcompare.h.

◆ operator<= [2/2]

bool operator<= ( QtPrivate::CompareAgainstLiteralZero ,
QPartialOrdering rhs )
friend

Definition at line 796 of file qcompare.h.

◆ operator== [1/5]

bool operator== ( QPartialOrdering lhs,
QPartialOrdering rhs )
friend

Return true if lhs and rhs represent the same result; otherwise, returns false.

Definition at line 820 of file qcompare.h.

◆ operator== [2/5]

bool operator== ( QPartialOrdering lhs,
Qt::partial_ordering rhs )
friend

Definition at line 862 of file qcompare.h.

References Qt::partial_ordering::operator==.

◆ operator== [3/5]

bool operator== ( QPartialOrdering lhs,
QtPrivate::CompareAgainstLiteralZero  )
friend

Definition at line 759 of file qcompare.h.

◆ operator== [4/5]

bool operator== ( Qt::partial_ordering lhs,
QPartialOrdering rhs )
friend

Definition at line 868 of file qcompare.h.

References Qt::partial_ordering::operator==.

◆ operator== [5/5]

bool operator== ( QtPrivate::CompareAgainstLiteralZero ,
QPartialOrdering rhs )
friend

Definition at line 784 of file qcompare.h.

◆ operator> [1/2]

bool operator> ( QPartialOrdering lhs,
QtPrivate::CompareAgainstLiteralZero  )
friend

Definition at line 775 of file qcompare.h.

◆ operator> [2/2]

bool operator> ( QtPrivate::CompareAgainstLiteralZero ,
QPartialOrdering rhs )
friend

Definition at line 800 of file qcompare.h.

◆ operator>= [1/2]

bool operator>= ( QPartialOrdering lhs,
QtPrivate::CompareAgainstLiteralZero  )
friend

Definition at line 779 of file qcompare.h.

◆ operator>= [2/2]

bool operator>= ( QtPrivate::CompareAgainstLiteralZero ,
QPartialOrdering rhs )
friend

Definition at line 804 of file qcompare.h.

Member Data Documentation

◆ Equivalent

QPartialOrdering QPartialOrdering::Equivalent
inlinestaticconstexpr

Definition at line 750 of file qcompare.h.

◆ equivalent

QPartialOrdering QPartialOrdering::equivalent
inlinestaticconstexpr

Definition at line 755 of file qcompare.h.

◆ Greater

QPartialOrdering QPartialOrdering::Greater
inlinestaticconstexpr

Definition at line 751 of file qcompare.h.

◆ greater

QPartialOrdering QPartialOrdering::greater
inlinestaticconstexpr

Definition at line 756 of file qcompare.h.

◆ Less

QPartialOrdering QPartialOrdering::Less
inlinestaticconstexpr

Definition at line 749 of file qcompare.h.

◆ less

QPartialOrdering QPartialOrdering::less
inlinestaticconstexpr

Definition at line 754 of file qcompare.h.

◆ Unordered

QPartialOrdering QPartialOrdering::Unordered
inlinestaticconstexpr

Definition at line 752 of file qcompare.h.

◆ unordered

QPartialOrdering QPartialOrdering::unordered
inlinestaticconstexpr

Definition at line 757 of file qcompare.h.


The documentation for this class was generated from the following files: