1 2 3 4
|
void case1(typename Shell<T>::template In<N>::template Deep<N>* p)
{
p->typename Deep<N>::f(); // EDITED to typename
}
|
The class
Weird Has no clue that nested classes
In and
Depp are templates them self.
that means the compiler will give you and error cos it dosn't know as well that these nested classes are templates.
To solve the problem you have to explicitly "tell the compiler" that these classes are templates.
to do you type template before template name and argument list like:
template In<T>
Even if you do so You will still get an compile time error cos compiler has no clue that this is a typename so you have to type
typename
at begining of declaration like:
typename Shell<T>
finaly you have to repeat that process for every typename, that is:
typename Shell<T>::template In<N>::template Deep<N>*
Which tells the compiler that Depp<N>* is a typename, in this case pointer to the type N
Still you didn't solve the proble and you'll still get compile time error within funcion it self!
p-> Deep<N>::f() // error
compiler has no clue that this is an template.
so you have to tell him explicitly that this is a template by doing so:
p->typename Deep<N>::f(); // EDITED to typename
Which is self explanatory, f() is a class mehtod of templated class Deep<N>
Finaly you have a mehtod:
1 2 3 4
|
void case1(typename Shell<T>::template In<N>::template Deep<N>* p)
{
p->typename Deep<N>::f(); // EDITED to typename
}
|
Which means the following:
function takes a pointer to the double nested class of type Deep<N> and it exectutes it's class method f().
Edited to replace template with typename