strong_ordering Class

class Qt::strong_ordering

Qt::strong_ordering 는 동등한 값을 구별할 수 없는 비교를 나타냅니다. 더 보기...

Header: #include <QtCompare>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
이후: Qt 6.7

공용 함수

strong_ordering(std::strong_ordering stdorder)
Qt::partial_ordering operator Qt::partial_ordering() const
Qt::weak_ordering operator Qt::weak_ordering() const
std::strong_ordering operator std::strong_ordering() const

정적 공용 멤버

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)

상세 설명

Qt::strong_ordering 타입의 값은 일반적으로 3방향 비교 함수에서 반환됩니다. 이러한 함수는 두 객체를 비교하여 순서를 설정합니다. 이 반환 유형은 순서가 엄격하다는 것을 나타내기 위해, 즉 함수가 잘 정의된 총 순서를 설정한다는 것을 나타내기 위해 사용됩니다.

Qt::strong_ordering 는 다음과 같은 기호 상수로 표현되는 네 가지 값을 갖습니다:

  • less 왼쪽 피연산자가 오른쪽 피연산자보다 작음을 나타냅니다;
  • equal 는 왼쪽 피연산자가 오른쪽 피연산자와 같음을 나타냅니다;
  • equivalentequal 의 별칭입니다;
  • greater 는 왼쪽 피연산자가 오른쪽 피연산자보다 크다는 것을 나타냅니다.

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

Qt::weak_ordering, Qt::partial_ordering, 비교 유형 개요를참조하세요 .

멤버 함수 문서

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

다음 규칙을 사용하여 stdorder 에서 Qt::strong_ordering 객체를 생성합니다:

  • std::strong_ordering::less는 less 로 변환됩니다.
  • std::strong_ordering::equivalent 는 equivalent 로 변환됩니다.
  • std::strong_ordering::equal는 equal 로 변환됩니다.
  • std::strong_ordering::greater 는 greater 로 변환됩니다.

[constexpr noexcept] Qt::partial_ordering strong_ordering::operator Qt::partial_ordering() const

다음 규칙을 사용하여 이 Qt::strong_ordering 값을 Qt::partial_ordering 객체로 변환합니다:

[constexpr noexcept] Qt::weak_ordering strong_ordering::operator Qt::weak_ordering() const

다음 규칙을 사용하여 이 Qt::strong_ordering 값을 Qt::weak_ordering 객체로 변환합니다:

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

다음 규칙을 사용하여 이 Qt::strong_ordering 값을 std::strong_ordering 객체로 변환합니다:

  • less std::strong_ordering::less로 변환합니다.
  • equivalent std::strong_ordering::equivalent로 변환합니다.
  • equal std::strong_ordering::equal로 변환합니다.
  • greater std::strong_ordering::greater로 변환합니다.

멤버 변수 문서

const Qt::strong_ordering strong_ordering::equal

왼쪽 피연산자가 오른쪽 피연산자와 같은 비교 결과를 나타냅니다. Qt::strong_ordering::equivalent 와 동일합니다.

const Qt::strong_ordering strong_ordering::equivalent

왼쪽 피연산자가 오른쪽 피연산자와 같은 비교 결과를 나타냅니다. Qt::strong_ordering::equal 와 동일합니다.

const Qt::strong_ordering strong_ordering::greater

왼쪽 피연산자가 오른쪽 피연산자보다 큰 비교 결과를 나타냅니다.

const Qt::strong_ordering strong_ordering::less

왼쪽 피연산자가 오른쪽 피연산자보다 작은 비교의 결과를 나타냅니다.

관련 비회원

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

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

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

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

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

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

o 를 6개의 관계형 연산자 중 하나의 결과로 변환합니다:

함수연산자
is_eqo == 0
is_neqo != 0
is_lto < 0
is_lteqo <= 0
is_gto > 0
is_gteqo >= 0

이 함수는 std::strong_ordering 와의 호환성을 위해 제공됩니다.

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

lhsrhs 이 서로 다른 결과를 나타내면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.

[constexpr noexcept] bool operator==(Qt::strong_ordering lhs, Qt::strong_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.