I am not sure what is your question exactly, but here is the explanation for the two examples you gave.
template <typename T, template <typename> class Cont>
class Stack;
Stack
is a class template with two template parameters. The first parameter, T
can be any type (including built-in types, user-defined types, template instantiations and so on). The second parameter, Cont
, must be a class template taking one parameter. The parameter is unnamed because it would not make much sense (the parameter is never bound to anything).
template <template <typename,typename> class Cont>
class Wrapper3;
Wrapper3
is a class template with a single parameter, Cont
. Cont
must be a class template with two parameters.
The syntax to define a template template parameter is the same as the one to define a class template (template <typename [param1], typename [param2], ...> class Name
), so I don't really understand what is your problem.
However, I agree that the syntax can become a bit awkward when you start "nesting" template template parameters:
// class template whose parameter must be a class template whose parameter
// must be a class template
template <template <template <typename> class > class C >
struct Wow {};
Doesn't happen that often, though...
Best Answer
U
is a dependent type so you need to specify thatf
is a template member:This is still invalid when
U
isA
, though, asf
is not astatic
member ofA
.