std:: common_comparison_category
|
헤더에 정의됨
<compare>
|
||
|
template
<
class
...
Ts
>
struct
common_comparison_category
|
(C++20부터) | |
클래스 템플릿
std::common_comparison_category
는 모든 템플릿 인자
Ts...
가 변환될 수 있는 가장 강력한 비교 범주에 대한 별칭(멤버 typedef
type
으로)을 제공합니다.
자세히 설명하면, n개의 타입 목록
T
0
...
T
n-1
의 공통 비교 타입은 다음과 같이 정의됩니다:
-
만약 어떤
Ti 가 비교 범주 타입이 아닌 경우 ( std::partial_ordering , std::weak_ordering , std::strong_ordering ),U는 void 입니다. -
그렇지 않고, 적어도 하나의
Ti 가 std::partial_ordering 인 경우,U는 std::partial_ordering 입니다. -
그렇지 않고, 적어도 하나의
Ti 가 std::weak_ordering 인 경우,U는 std::weak_ordering 입니다. -
그 외의 경우 (모든
Ti 가 std::strong_ordering 이거나, 리스트가 비어 있는 경우),U는 std::strong_ordering 입니다.
목차 |
템플릿 매개변수
| ...Ts | - | 가능한 빈 타입 목록 |
헬퍼 템플릿
|
template
<
class
...
Ts
>
using common_comparison_category_t = common_comparison_category < Ts... > :: type ; |
(C++20 이후) | |
멤버 타입
| 멤버 타입 | 정의 |
type
|
가장 강력한 공통 비교 범주 (위에서 정의된 대로) |
가능한 구현
namespace detail { template<unsigned int> struct common_cmpcat_base { using type = void; }; template<> struct common_cmpcat_base<0u> { using type = std::strong_ordering; }; template<> struct common_cmpcat_base<2u> { using type = std::partial_ordering; }; template<> struct common_cmpcat_base<4u> { using type = std::weak_ordering; }; template<> struct common_cmpcat_base<6u> { using type = std::partial_ordering; }; } // 네임스페이스 detail template<class...Ts> struct common_comparison_category : detail::common_cmpcat_base<(0u | ... | (std::is_same_v<Ts, std::strong_ordering> ? 0u : std::is_same_v<Ts, std::weak_ordering> ? 4u : std::is_same_v<Ts, std::partial_ordering> ? 2u : 1u) )> {}; |
예제
|
이 섹션은 불완전합니다
이유: 예제가 없음 |
참고 항목
|
(C++20)
|
6개의 연산자를 모두 지원하고 대체 가능한 3-way 비교의 결과 타입
(class) |
|
(C++20)
|
6개의 연산자를 모두 지원하지만 대체 불가능한 3-way 비교의 결과 타입
(class) |
|
(C++20)
|
6개의 연산자를 모두 지원하고, 대체 불가능하며, 비교 불가능한 값을 허용하는 3-way 비교의 결과 타입
(class) |