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:767
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
const GLubyte * c
GLuint64EXT * result
[6]
static int compare(quint64 a, quint64 b)
double d
[1]

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

Definition at line 687 of file qcompare.h.

Constructor & Destructor Documentation

◆ QPartialOrdering() [1/3]

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

Definition at line 767 of file qcompare.h.

◆ QPartialOrdering() [2/3]

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

Definition at line 778 of file qcompare.h.

◆ QPartialOrdering() [3/3]

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

Definition at line 781 of file qcompare.h.

Member Function Documentation

◆ operator Qt::partial_ordering()

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

Definition at line 784 of file qcompare.h.

Friends And Related Symbol Documentation

◆ is_eq

QT_WARNING_PUSH friend constexpr bool is_eq ( QPartialOrdering o)
friend

Definition at line 873 of file qcompare.h.

◆ is_gt

bool is_gt ( QPartialOrdering o)
friend

Definition at line 877 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 878 of file qcompare.h.

◆ is_lt

bool is_lt ( QPartialOrdering o)
friend

Definition at line 875 of file qcompare.h.

◆ is_lteq

bool is_lteq ( QPartialOrdering o)
friend

Definition at line 876 of file qcompare.h.

◆ is_neq

bool is_neq ( QPartialOrdering o)
friend

Definition at line 874 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 764 of file qcompare.h.

◆ operator!= [2/5]

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

Definition at line 806 of file qcompare.h.

References Qt::partial_ordering::operator!=.

◆ operator!= [3/5]

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

Definition at line 704 of file qcompare.h.

◆ operator!= [4/5]

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

Definition at line 812 of file qcompare.h.

References Qt::partial_ordering::operator!=.

◆ operator!= [5/5]

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

Definition at line 729 of file qcompare.h.

◆ operator< [1/2]

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

Definition at line 708 of file qcompare.h.

◆ operator< [2/2]

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

Definition at line 733 of file qcompare.h.

◆ operator<= [1/2]

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

Definition at line 712 of file qcompare.h.

◆ operator<= [2/2]

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

Definition at line 737 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 761 of file qcompare.h.

◆ operator== [2/5]

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

Definition at line 803 of file qcompare.h.

References Qt::partial_ordering::operator==.

◆ operator== [3/5]

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

Definition at line 700 of file qcompare.h.

◆ operator== [4/5]

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

Definition at line 809 of file qcompare.h.

References Qt::partial_ordering::operator==.

◆ operator== [5/5]

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

Definition at line 725 of file qcompare.h.

◆ operator> [1/2]

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

Definition at line 716 of file qcompare.h.

◆ operator> [2/2]

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

Definition at line 741 of file qcompare.h.

◆ operator>= [1/2]

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

Definition at line 720 of file qcompare.h.

◆ operator>= [2/2]

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

Definition at line 745 of file qcompare.h.

Member Data Documentation

◆ Equivalent

QPartialOrdering QPartialOrdering::Equivalent
inlinestaticconstexpr

Definition at line 691 of file qcompare.h.

◆ equivalent

QPartialOrdering QPartialOrdering::equivalent
inlinestaticconstexpr

Definition at line 696 of file qcompare.h.

◆ Greater

QPartialOrdering QPartialOrdering::Greater
inlinestaticconstexpr

Definition at line 692 of file qcompare.h.

◆ greater

QPartialOrdering QPartialOrdering::greater
inlinestaticconstexpr

Definition at line 697 of file qcompare.h.

◆ Less

QPartialOrdering QPartialOrdering::Less
inlinestaticconstexpr

Definition at line 690 of file qcompare.h.

◆ less

QPartialOrdering QPartialOrdering::less
inlinestaticconstexpr

Definition at line 695 of file qcompare.h.

◆ Unordered

QPartialOrdering QPartialOrdering::Unordered
inlinestaticconstexpr

Definition at line 693 of file qcompare.h.

◆ unordered

QPartialOrdering QPartialOrdering::unordered
inlinestaticconstexpr

Definition at line 698 of file qcompare.h.


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