namespace std {
template<class T1, class T2, class U1, class U2>
requires requires { typename pair<common_type_t<T1, U1>, common_type_t<T2, U2>>; }
struct common_type<pair<T1, T2>, pair<U1, U2>> {
using type = pair<common_type_t<T1, U1>, common_type_t<T2, U2>>;
};
}
概要
pairについて、どちらからも変換可能な共通の型を取得できるようにするcommon_typeの特殊化である。
効果
pair<common_type_t<T1, U1>, common_type_t<T2, U2>>によって得られた型をメンバ型typeとして定義する。
備考
pair<common_type_t<T1, U1>, common_type_t<T2, U2>>が型を表すこと。
バージョン
言語
- C++23
処理系
- Clang: 3.0 ✅
- GCC: 4.6.1 ✅
- Visual C++: 2012 ✅