partial_ordering Class

class Qt::partial_ordering

Qt::partial_ordering 並べ替えのできない比較結果を表します。さらに...

ヘッダ #include <QtCompare>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
以来:Qt 6.7

パブリック関数

partial_ordering(std::partial_ordering stdorder)
std::partial_ordering operator std::partial_ordering() const

静的パブリックメンバ

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

詳細説明

Qt::partial_ordering 型の値は、通常、3 者間比較関数から返されます。このような関数は2つのオブジェクトを比較し、それらが順序付けされているかどうか、順序付けされている場合はその順序を確定します。つまり、すべての値のペアが順序付けされているわけではありません。

Qt::partial_ordering には4つの値があり、以下の記号定数で表されます:

  • less は左オペランドが右オペランドより小さいことを表します;
  • equivalent 2つのオペランドが等価であることを表します;
  • greater 左オペランドが右オペランドより大きいことを表します;
  • unordered 2つのオペランドが順序付けされていないことを表します。

Qt::partial_ordering は、例えばこのように、インスタンスをリテラル0と比較することで慣用的に使用されます:

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

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

Qt::partial_ordering::unordered 、リテラル0と比較すると、常にfalse の結果が返されます。

Qt::strong_orderingQt::weak_ordering比較型の概要も参照のこと

メンバ関数ドキュメント

[constexpr noexcept] partial_ordering::partial_ordering(std::partial_ordering stdorder)

以下の規則を用いてstdorder からQt::partial_ordering オブジェクトを構築する:

  • std::partial_ordering::less はless に変換する。
  • std::partial_ordering::equivalent はequivalent に変換する。
  • std::partial_ordering::greater はgreater に変換されます。
  • std::partial_ordering::unordered は以下に変換されます。unordered

[constexpr noexcept] std::partial_ordering partial_ordering::operator std::partial_ordering() const

このQt::partial_ordering の値を以下のルールで std::partial_ordering オブジェクトに変換します:

  • less は std::partial_ordering::less に変換します。
  • equivalent std::partial_ordering::equivalent に変換します。
  • greater は std::partial_ordering::greater に変換されます。
  • unordered は std::partial_ordering::unordered に変換します。

メンバ変数ドキュメント

const Qt::partial_ordering partial_ordering::equivalent

2つのオペランドが等価である場合の比較結果を表します。

const Qt::partial_ordering partial_ordering::greater

左オペランドが右オペランドより大きい場合の比較結果を表します。

const Qt::partial_ordering partial_ordering::less

左オペランドが右オペランドより小さい場合の比較結果を表します。

const Qt::partial_ordering partial_ordering::unordered

2つのオペランド間に順序関係がない場合の比較結果を表す。

関連する非会員

[constexpr noexcept] bool is_eq(Qt::partial_ordering o)

[constexpr noexcept] bool is_gt(Qt::partial_ordering o)

[constexpr noexcept] bool is_gteq(Qt::partial_ordering o)

[constexpr noexcept] bool is_lt(Qt::partial_ordering o)

[constexpr noexcept] bool is_lteq(Qt::partial_ordering o)

[constexpr noexcept] bool is_neq(Qt::partial_ordering o)

o を6つの関係演算子のうちの1つの結果に変換する:

関数操作
is_eqo == 0
is_neqo != 0
is_lto < 0
is_lteqo <= 0
is_gto > 0
is_gteqo >= 0

これらの関数は、std::partial_ordering との互換性のために提供されています。

[constexpr noexcept] bool operator!=(Qt::partial_ordering lhs, Qt::partial_ordering rhs)

lhsrhs が異なる結果を表す場合は真を返す。そうでない場合は真を返す。

[constexpr noexcept] bool operator==(Qt::partial_ordering lhs, Qt::partial_ordering rhs)

lhsrhs が同じ結果を表す場合は真を返し、そうでない場合は偽を返す。

© 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.