Consider the following code:
template<typename T, size_t... i>
class Bar{};
template<typename T1, typename T2>
class Foo{};
template<typename T1, size_t... i1>
template<typename T2, size_t... i2>
struct Foo<Bar<T1,i1...>,Bar<T2,i2...>>
{
struct Eq {};
};
As you can see, there is a variational type Bar<T,size_t...>and a type Foo<T1,T2>. Foo specializes in the case where two are used as template parameters Bar. This specialization has an internal type Eq.
However, the following does not work:
typename Foo<Bar<int,2>,Bar<int,3>>::Eq b;
It is reported that in Foo<Bar<int,2>,Bar<int,3>>there is no type Eq, i.e. the compiler does not choose the specialization of the template, but a basic definition Foo<T1,T2>that really does not have an internal type Eq.
What am I doing wrong here? Why doesn't the compiler choose specialization?