Namespaces
Variants
Views
Actions

std::common_type<std::pair>

From cppreference.com
< cpp‎ | utility‎ | pair
 
 
Utilities library
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)
 
std::pair
Member functions
(C++11)
Non-member functions
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
(C++11)
(C++11)
Deduction guides(C++17)
Helper classes
(C++11)
common_type
(C++23)
 
Defined in header <utility>
template< class T1, class T2, class U1, class U2 >

  requires requires { typename std::pair<std::common_type_t<T1, U1>,
                                         std::common_type_t<T2, U2>>; }

struct common_type<std::pair<T1, T2>, std::pair<U1, U2>>;
(since C++23)

The common type of two pairs is a pair of both common types of corresponding element types of both pairs.

The common type is defined only if both pairs of corresponding element types have common types.

[edit] Member types

Member type Definition
type std::pair<std::common_type_t<T1, U1>, std::common_type_t<T2, U2>>

[edit] Example

[edit] See also

determines the common type of a group of types
(class template) [edit]
determines the common type of a tuple and a tuple-like type
(class template specialization) [edit]