このページでは

QPartialOrdering Class

QPartialOrdering は、順序付けられていない結果も許容する比較の結果を表します。詳細...

ヘッダー: #include <QPartialOrdering>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
以下のように: Qt 6.0

パブリック関数

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

静的パブリックメンバー

const QPartialOrdering Equivalent
const QPartialOrdering Greater
const QPartialOrdering Less
const QPartialOrdering Unordered
const QPartialOrdering equivalent
const QPartialOrdering greater
const QPartialOrdering less
const QPartialOrdering unordered
(since 6.7) bool is_eq(QPartialOrdering o)
(since 6.7) bool is_gt(QPartialOrdering o)
(since 6.7) bool is_gteq(QPartialOrdering o)
(since 6.7) bool is_lt(QPartialOrdering o)
(since 6.7) bool is_lteq(QPartialOrdering o)
(since 6.7) bool is_neq(QPartialOrdering o)
bool operator!=(QPartialOrdering lhs, QPartialOrdering rhs)
bool operator==(QPartialOrdering lhs, QPartialOrdering rhs)

詳細な説明

QPartialOrdering 型の値は、通常、3 項比較関数から返されます。この関数は 2 つのオブジェクトを比較し、それらが順序付けられているかどうか、また順序付けられている場合はその順序を決定します。この戻り値の型は、順序付けが部分的であることを示すために使用されます。つまり、すべての値のペアが順序付けられているわけではありません。

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

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

QPartialOrdering は、インスタンスをリテラル 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:

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
}

QPartialOrdering::unordered をリテラル 0 と比較すると、常に `false ` という結果が返されます。

Qt::strong_ordering 、Qt::weak_ordering 、および比較型の概要も参照してください 。

メンバ関数のドキュメント

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

stdorder から、以下のルールに従って QPartialOrdering オブジェクトを生成します。

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

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

この `QPartialOrdering ` 値を、以下のルールに従って `std::partial_ordering` オブジェクトに変換します。

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

メンバ変数のドキュメント

const QPartialOrdering QPartialOrdering::Equivalent

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

const QPartialOrdering QPartialOrdering::Greater

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

const QPartialOrdering QPartialOrdering::Less

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

const QPartialOrdering QPartialOrdering::Unordered

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

const QPartialOrdering QPartialOrdering::equivalent

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

const QPartialOrdering QPartialOrdering::greater

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

const QPartialOrdering QPartialOrdering::less

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

const QPartialOrdering QPartialOrdering::unordered

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

関連する非メンバー

[constexpr noexcept, since 6.7] bool is_eq(QPartialOrdering o)

[constexpr noexcept, since 6.7] bool is_gt(QPartialOrdering o)

[constexpr noexcept, since 6.7] bool is_gteq(QPartialOrdering o)

[constexpr noexcept, since 6.7] bool is_lt(QPartialOrdering o)

[constexpr noexcept, since 6.7] bool is_lteq(QPartialOrdering o)

[constexpr noexcept, since 6.7] bool is_neq(QPartialOrdering o)

o を、以下の 6 つの関係演算子のいずれかの結果に変換します:

関数演算
is_eqo == 0
is_neqo != 0
is_lto < 0
is_lteqo <= 0
is_gto > 0
is_gteqo >= 0

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

これらの関数は Qt 6.7 で導入されました。

[constexpr noexcept] bool operator!=(QPartialOrdering lhs, QPartialOrdering rhs)

lhs とrhs が異なる結果を表す場合は true を返し、そうでない場合は true を返す。

[constexpr noexcept] bool operator==(QPartialOrdering lhs, QPartialOrdering rhs)

lhs とrhs が同じ結果を表す場合は true を返し、そうでない場合は false を返します。

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