Qt::strong_ordering Class | Qt Core (original) (raw)

class Qt::strong_ordering

Qt::strong_ordering represents a comparison where equivalent values are indistinguishable. More...

Header: #include
CMake: find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 6.7

Public Functions

Static Public Members

const Qt::strong_ordering equal
const Qt::strong_ordering equivalent
const Qt::strong_ordering greater
const Qt::strong_ordering less
bool is_eq(Qt::strong_ordering o)
bool is_gt(Qt::strong_ordering o)
bool is_gteq(Qt::strong_ordering o)
bool is_lt(Qt::strong_ordering o)
bool is_lteq(Qt::strong_ordering o)
bool is_neq(Qt::strong_ordering o)
bool operator!=(Qt::strong_ordering lhs, Qt::strong_ordering rhs)
bool operator==(Qt::strong_ordering lhs, Qt::strong_ordering rhs)

Detailed Description

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:

Qt::strong_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::strong_ordering compare(T lhs, T rhs); // defined out-of-line

~~~

Qt::strong_ordering 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 }

See also Qt::weak_ordering, Qt::partial_ordering, and Comparison types overview.

Member Variable Documentation

const Qt::strong_ordering strong_ordering::equal

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

const Qt::strong_ordering strong_ordering::equivalent

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

const Qt::strong_ordering strong_ordering::greater

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

const Qt::strong_ordering strong_ordering::less

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

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.