Namespaces
Variants

std::common_type<튜플 유사>

cppreference.net에서 가져옴
 
 
유틸리티 라이브러리
일반 유틸리티
관계 연산자 (C++20부터 비권장)
정수 비교 함수
(C++20)(C++20)(C++20)    
(C++20)
스왑 및 타입 연산
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
공통 어휘 타입
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
헤더 <tuple>
template< tuple-like TTuple, tuple-like UTuple >
    requires /* see below */
struct common_type<TTuple, UTuple>;
에 정의됨 (C++23부터)

두 tuple-like 타입의 공통 타입은, 두 타입의 모든 대응 요소 타입 쌍의 공통 타입으로 구성된 std::tuple입니다.

주어졌을 때,

  • TTypes를 std::tuple_element_t<i, TTuple>의 i 범위의 모든 정수 [​0, std::tuple_size_v<TTuple>)에 대한 시퀀스로 구성된 팩이라 하고,
  • UTypes를 std::tuple_element_t<i, UTuple>의 i 범위의 모든 정수 [​0, std::tuple_size_v<UTuple>)에 대한 시퀀스로 구성된 팩이라 할 때,

다음 제약 조건을 만족해야 합니다:

  • TTuple 또는 UTuple는 std::tuple 특수화입니다.
  • std::is_same_v<TTuple, std::decay_t<TTuple>>는 true입니다.
  • std::is_same_v<UTuple, std::decay_t<UTuple>>는 true입니다.
  • std::tuple_size_v<TTuple>은 std::tuple_size_v<UTuple>와 같습니다 (TTuple과 UTuple은 요소 개수가 같습니다).
  • std::tuple<std::common_type_t<TTypes, UTypes>...>는 타입을 나타냅니다.

멤버 타입

멤버 타입 정의
type std:: tuple < std:: common_type_t < TTypes, UTypes > ... >

예제

참고 항목

여러 타입들의 공통 타입을 결정함
(클래스 템플릿)
두 개의 pair 의 공통 타입을 결정함
(클래스 템플릿 특수화)