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
Qt::weak_ordering Class Reference

\variable Qt::strong_ordering::less More...

#include <qcompare.h>

+ Collaboration diagram for Qt::weak_ordering:

Public Member Functions

constexpr Q_IMPLICIT operator partial_ordering () const noexcept
 

Static Public Attributes

static const weak_ordering less
 
static const weak_ordering equivalent
 
static const weak_ordering greater
 

Friends

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

Related Symbols

(Note that these are not member symbols.)

bool operator== (Qt::weak_ordering lhs, QtPrivate::CompareAgainstLiteralZero)
 
bool operator== (Qt::weak_ordering lhs, QtPrivate::CompareAgainstLiteralZero)
 

Detailed Description

\variable Qt::strong_ordering::less

\fn Qt::strong_ordering::is_eq  (Qt::strong_ordering o)
\fn Qt::strong_ordering::is_neq (Qt::strong_ordering o)
\fn Qt::strong_ordering::is_lt  (Qt::strong_ordering o)
\fn Qt::strong_ordering::is_lteq(Qt::strong_ordering o)
\fn Qt::strong_ordering::is_gt  (Qt::strong_ordering o)
\fn Qt::strong_ordering::is_gteq(Qt::strong_ordering o)

! [is_eq_table] Converts o into the result of one of the six relational operators: \table \header

  • Function
  • Operation \row
  • {is_eq}
  • o {== 0} \row
  • {is_neq}
  • o {!= 0} \row
  • {is_lt}
  • o {< 0} \row
  • {is_lteq}
  • o {<= 0} \row
  • {is_gt}
  • o {> 0} \row
  • {is_gteq}
  • o {>= 0} \endtable ! [is_eq_table]
    These functions are provided for compatibility with \c{std::strong_ordering}.
    

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

\variable Qt::strong_ordering::equivalent

Represents the result of a comparison where the left operand is equal to the right operand. Same as \l {Qt::strong_ordering::equal}.

\variable Qt::strong_ordering::equal

Represents the result of a comparison where the left operand is equal to the right operand. Same as \l {Qt::strong_ordering::equivalent}.

\variable Qt::strong_ordering::greater

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

\inmodule QtCore \inheaderfile QtCompare

Qt::weak_ordering represents a comparison where equivalent values are still distinguishable.

See also
Qt::strong_ordering, Qt::partial_ordering, {Comparison types overview}
Since
6.7

A value of type Qt::weak_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 weak; that is, equivalent values may be distinguishable.

Qt::weak_ordering has three 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 left operand is equivalent to the right;
  • \l greater represents that the left operand is greater than the right, \endlist

Qt::weak_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::weak_ordering compare(T lhs, T rhs); // defined out-of-line
~~~
Qt::weak_ordering result = compare(a, b);
if (result < 0) {
// a is less than b
}
if (compare(c, d) >= 0) {
// c is greater than or equivalent to d
}
\variable Qt::strong_ordering::less
Definition qcompare.h:262
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]

Definition at line 261 of file qcompare.h.

Member Function Documentation

◆ operator partial_ordering()

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

Definition at line 268 of file qcompare.h.

Friends And Related Symbol Documentation

◆ is_eq

QT_WARNING_PUSH friend constexpr bool is_eq ( Qt::weak_ordering o)
friend

Definition at line 426 of file qcompare.h.

◆ is_gt

bool is_gt ( Qt::weak_ordering o)
friend

Definition at line 430 of file qcompare.h.

◆ is_gteq

bool is_gteq ( Qt::weak_ordering o)
friend

is_eq_table

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

Definition at line 431 of file qcompare.h.

◆ is_lt

bool is_lt ( Qt::weak_ordering o)
friend

Definition at line 428 of file qcompare.h.

◆ is_lteq

bool is_lteq ( Qt::weak_ordering o)
friend

Definition at line 429 of file qcompare.h.

◆ is_neq

bool is_neq ( Qt::weak_ordering o)
friend

Definition at line 427 of file qcompare.h.

◆ operator!= [1/5]

bool operator!= ( partial_ordering lhs,
weak_ordering rhs )
friend

Definition at line 347 of file qcompare.h.

◆ operator!= [2/5]

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

Definition at line 300 of file qcompare.h.

◆ operator!= [3/5]

bool operator!= ( weak_ordering lhs,
partial_ordering rhs )
friend

Definition at line 341 of file qcompare.h.

◆ operator!= [4/5]

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

Definition at line 275 of file qcompare.h.

◆ operator!= [5/5]

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

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

Definition at line 335 of file qcompare.h.

◆ operator< [1/2]

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

Definition at line 304 of file qcompare.h.

◆ operator< [2/2]

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

Definition at line 279 of file qcompare.h.

◆ operator<= [1/2]

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

Definition at line 308 of file qcompare.h.

◆ operator<= [2/2]

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

Definition at line 283 of file qcompare.h.

◆ operator== [1/7]

bool operator== ( partial_ordering lhs,
weak_ordering rhs )
friend

Definition at line 344 of file qcompare.h.

◆ operator==() [2/7]

bool operator== ( Qt::weak_ordering lhs,
QtPrivate::CompareAgainstLiteralZero  )
related

◆ operator==() [3/7]

bool operator== ( Qt::weak_ordering lhs,
QtPrivate::CompareAgainstLiteralZero  )
related

◆ operator== [4/7]

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

Definition at line 296 of file qcompare.h.

◆ operator== [5/7]

bool operator== ( weak_ordering lhs,
partial_ordering rhs )
friend

Definition at line 338 of file qcompare.h.

◆ operator== [6/7]

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

Definition at line 271 of file qcompare.h.

◆ operator== [7/7]

bool operator== ( Qt::weak_ordering lhs,
Qt::weak_ordering rhs )
friend

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

Definition at line 332 of file qcompare.h.

◆ operator> [1/2]

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

Definition at line 312 of file qcompare.h.

◆ operator> [2/2]

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

Definition at line 287 of file qcompare.h.

◆ operator>= [1/2]

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

Definition at line 316 of file qcompare.h.

◆ operator>= [2/2]

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

Definition at line 291 of file qcompare.h.

◆ strong_ordering

friend class strong_ordering
friend

Definition at line 416 of file qcompare.h.

Member Data Documentation

◆ equivalent

weak_ordering Qt::weak_ordering::equivalent
inlinestaticconstexpr

Definition at line 265 of file qcompare.h.

◆ greater

weak_ordering Qt::weak_ordering::greater
inlinestaticconstexpr

Definition at line 266 of file qcompare.h.

◆ less

weak_ordering Qt::weak_ordering::less
inlinestaticconstexpr

Definition at line 264 of file qcompare.h.


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