weak_ordering Class
class Qt::weak_orderingQt::weak_ordering は、同等の値がまだ区別できる比較を表します。さらに...
ヘッダ | #include <QtCompare> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
以来: | Qt 6.7 |
パブリック関数
weak_ordering(std::weak_ordering stdorder) | |
Qt::partial_ordering | operator Qt::partial_ordering() const |
std::weak_ordering | operator std::weak_ordering() const |
静的パブリックメンバ
const Qt::weak_ordering | equivalent |
const Qt::weak_ordering | greater |
const Qt::weak_ordering | less |
関連する非メンバー
bool | is_eq(Qt::weak_ordering o) |
bool | is_gt(Qt::weak_ordering o) |
bool | is_gteq(Qt::weak_ordering o) |
bool | is_lt(Qt::weak_ordering o) |
bool | is_lteq(Qt::weak_ordering o) |
bool | is_neq(Qt::weak_ordering o) |
bool | operator!=(Qt::weak_ordering lhs, Qt::weak_ordering rhs) |
bool | operator==(Qt::weak_ordering lhs, Qt::weak_ordering rhs) |
詳細説明
Qt::weak_ordering 型の値は、通常、3 者間比較関数から返されます。このような関数は2つのオブジェクトを比較し、それらがどのように順序付けされているかを確立します。つまり、等価な値が区別できる可能性があります。
Qt::weak_ordering には3つの値があり、以下の記号定数で表されます:
- less は、左オペランドが右オペランドより小さいことを表します;
- equivalent 左オペランドが右オペランドと等価であることを表します;
- greater 左オペランドが右オペランドより大きいことを表します、
Qt::weak_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::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 }
Qt::strong_ordering 、Qt::partial_ordering 、比較型の概要も参照のこと 。
メンバ関数ドキュメント
[constexpr noexcept]
weak_ordering::weak_ordering(std::weak_ordering stdorder)
以下の規則を用いてstdorder からQt::weak_ordering オブジェクトを構築する:
- std::weak_ordering::less はless に変換する。
- std::weak_ordering::equivalent はequivalent に変換する。
- std::weak_ordering::greater はgreater に変換する。
[constexpr noexcept]
Qt::partial_ordering weak_ordering::operator Qt::partial_ordering() const
このQt::weak_ordering の値を、以下のルールでQt::partial_ordering オブジェクトに変換する:
- less Qt::partial_ordering::less に変換します。
- equivalent Qt::partial_ordering::equivalent に変換する。
- greater Qt::partial_ordering::greater に変換する。
[constexpr noexcept]
std::weak_ordering weak_ordering::operator std::weak_ordering() const
このQt::weak_ordering の値を以下のルールで std::weak_ordering オブジェクトに変換する:
- less は std::weak_ordering::less に変換します。
- equivalent std::weak_ordering::equivalent に変換します。
- greater は std::weak_ordering::greater に変換されます。
メンバ変数ドキュメント
const Qt::weak_ordering weak_ordering::equivalent
左オペランドが右オペランドと等価である比較結果を表します。
const Qt::weak_ordering weak_ordering::greater
左オペランドが右オペランドより大きい場合の比較結果を表します。
const Qt::weak_ordering weak_ordering::less
左オペランドが右オペランドより小さい比較結果を表します。
関連する非会員
[constexpr noexcept]
bool is_eq(Qt::weak_ordering o)
[constexpr noexcept]
bool is_gt(Qt::weak_ordering o)
[constexpr noexcept]
bool is_gteq(Qt::weak_ordering o)
[constexpr noexcept]
bool is_lt(Qt::weak_ordering o)
[constexpr noexcept]
bool is_lteq(Qt::weak_ordering o)
[constexpr noexcept]
bool is_neq(Qt::weak_ordering o)
o を6つの関係演算子のうちの1つの結果に変換する:
関数 | 操作 |
---|---|
is_eq | o == 0 |
is_neq | o != 0 |
is_lt | o < 0 |
is_lteq | o <= 0 |
is_gt | o > 0 |
is_gteq | o >= 0 |
これらの関数は、std::weak_ordering
との互換性のために提供されています。
[constexpr noexcept]
bool operator!=(Qt::weak_ordering lhs, Qt::weak_ordering rhs)
lhs とrhs が異なる結果を表す場合、true を返す。そうでない場合、true を返す。
[constexpr noexcept]
bool operator==(Qt::weak_ordering lhs, Qt::weak_ordering rhs)
lhs とrhs が同じ結果を表す場合は真を返し、そうでない場合は偽を返す。
© 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.