I would like to define two particular default cases for a template class A
.
Is something similar possible?:
template<typename T1, typename T2>
class A{
// ...
};
struct X;
// if necessary, I can also define X right here.
template<>
A<X> = A<X,int>;
template<typename T>
A<T> = A<T,T>;
int main(){
A<X> a; // shall construct an instance of A<X,int>
A<float> b; // shall construct an instance of A<float,float>
}
I see how it can be done by using a derived of A. However, I would hope that it is also possible in a similarly straight-forward way to the one presented in the non-functioning snippet above.