Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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)
 

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

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

Definition at line 220 of file qcompare.h.

Member Function Documentation

◆ operator partial_ordering()

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

Definition at line 227 of file qcompare.h.

Friends And Related Symbol Documentation

◆ is_eq

Qt::weak_ordering::is_eq ( Qt::weak_ordering o)
friend

Definition at line 384 of file qcompare.h.

◆ is_gt

Qt::weak_ordering::is_gt ( Qt::weak_ordering o)
friend

Definition at line 388 of file qcompare.h.

◆ is_gteq

Qt::weak_ordering::is_gteq ( Qt::weak_ordering o)
friend

is_eq_table

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

Definition at line 389 of file qcompare.h.

◆ is_lt

Qt::weak_ordering::is_lt ( Qt::weak_ordering o)
friend

Definition at line 386 of file qcompare.h.

◆ is_lteq

Qt::weak_ordering::is_lteq ( Qt::weak_ordering o)
friend

Definition at line 387 of file qcompare.h.

◆ is_neq

Qt::weak_ordering::is_neq ( Qt::weak_ordering o)
friend

Definition at line 385 of file qcompare.h.

◆ operator!= [1/5]

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

Definition at line 306 of file qcompare.h.

◆ operator!= [2/5]

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

Definition at line 259 of file qcompare.h.

◆ operator!= [3/5]

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

Definition at line 300 of file qcompare.h.

◆ operator!= [4/5]

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

Definition at line 234 of file qcompare.h.

◆ operator!= [5/5]

bool Qt::weak_ordering::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 294 of file qcompare.h.

◆ operator< [1/2]

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

Definition at line 263 of file qcompare.h.

◆ operator< [2/2]

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

Definition at line 238 of file qcompare.h.

◆ operator<= [1/2]

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

Definition at line 267 of file qcompare.h.

◆ operator<= [2/2]

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

Definition at line 242 of file qcompare.h.

◆ operator== [1/6]

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

Definition at line 303 of file qcompare.h.

◆ operator==() [2/6]

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

◆ operator== [3/6]

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

Definition at line 255 of file qcompare.h.

◆ operator== [4/6]

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

Definition at line 297 of file qcompare.h.

◆ operator== [5/6]

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

Definition at line 230 of file qcompare.h.

◆ operator== [6/6]

bool Qt::weak_ordering::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 291 of file qcompare.h.

◆ operator> [1/2]

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

Definition at line 271 of file qcompare.h.

◆ operator> [2/2]

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

Definition at line 246 of file qcompare.h.

◆ operator>= [1/2]

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

Definition at line 275 of file qcompare.h.

◆ operator>= [2/2]

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

Definition at line 250 of file qcompare.h.

◆ strong_ordering

friend class strong_ordering
friend

Definition at line 375 of file qcompare.h.

Member Data Documentation

◆ equivalent

constexpr weak_ordering Qt::weak_ordering::equivalent
inlinestaticconstexpr

Definition at line 224 of file qcompare.h.

◆ greater

constexpr weak_ordering Qt::weak_ordering::greater
inlinestaticconstexpr

Definition at line 225 of file qcompare.h.

◆ less

constexpr weak_ordering Qt::weak_ordering::less
inlinestaticconstexpr

Definition at line 223 of file qcompare.h.


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