I am considering Class1, Class2, Class3.
Class2 and Class3 have a partial specialisation with int, so they are identical in their definition.
On the other hand, Class1 has a specialisation for Class3<T> and for a general template template with only one argument, i.e. Unary<T>. So Class1 has no specialisation for Class2<T>.
It happens that Class1 <Class3<T>>::type is actually Class3<T>. Indeed I explicitly wrote the specialisation. However, the compiler says Class1 <Class2<T>>::type it is not defined. But I defined the specialisation for a the template template case, Class1<Unary<T>>. Why is the compiler not recognising it? How can I make the compiler choose the most specialised case (Class1 <Class3<T>>::type), if it exists, and, if does not, the template template case (Class1<Unary<T>>)? Thank you
template<typename...T>
class Class1;
template<typename...T>
class Class2;
template<typename...T>
class Class3;
template<>
class Class2<int>
{};
template<>
class Class3<int>
{};
template<typename T>
class Class1<Class3<T>>
{
public:
using type=Class3<T>;
};
template<template<class> class Unary, typename T>
class Class1<Unary<T>>
{
public:
using type=Unary<T>;
};