Map two types at compile time
问题 I have a set of types related with a one-to-one relation, for example: TypeA ---> Type1 TypeB ---> Type2 TypeC ---> Type3 I know these relation at compile time. Then, I have a template class that depends on this two types: template<class T1,class T2> class MyClass { T1 foo; T2 bar; }; Now, the user of my library will type something like: MyClass<TypeA,Type1> x; This is inconvenient because there is a dependency between the two types and it should be enough for the user specify only the first