Complex template inheritance How do I type it?

I am not sure if it is a problem of CUDA compiler or Visual Studio compiler or my lack of knowledge of C++. I have something like that:

template <typename T1, typename T2>

class Pair {

public:

	T1 x;

	T2 y;

	template <int size>

	class Array {

	public:

		T1 x;

		T2 y;

	};

};

template <typename T1, typename T2>

class PairVector : public Pair<T1,T2> {

public:

	template <int size>

	class Array : public Pair<T1,T2>::template Array < size > { //<-- this causes an error

	};

};

int main() {

  PairVector<int,int>::Array<5> p;

}

It fails with an error:

error C2955: ‘Pair<T1,T2>::Array’ : use of class template requires template argument list

Although the template argument list is provided!

Also I tried declaring it like this:

[...]

	template <int size>

	class Array : public ParentArray {

	public:

		typedef typename Pair<T1,T2>::template Array < size > ParentArray;

	};

It ends up with an error: “not a class or struct name” during instanciation for the variable p of the main function.

Any suggestions on how to make it work?

Changing

class Array : public Pair<T1,T2>::template Array < size >

to

class Array : public Pair<T1,T2>::Array < size >

will not give a compiler error. Don’t know if this is what you want though.

Changing

class Array : public Pair<T1,T2>::template Array < size >

to

class Array : public Pair<T1,T2>::Array < size >

will not give a compiler error. Don’t know if this is what you want though.

That is exactly what I want, but…
although it won’t give compile error from Visual Studio, it will from the CUDA compiler:

error: nontype “Pair<T1, T2>::Array [with T1=T1, T2=T2]” is not a template

That is exactly what I want, but…
although it won’t give compile error from Visual Studio, it will from the CUDA compiler:

error: nontype “Pair<T1, T2>::Array [with T1=T1, T2=T2]” is not a template