The template parameter CLASS
is declared to be a class
, or also a typename
, I.e. the name of a type.
template<typename X> struct A;
Here A
isn't a type, it's a template. To obtain a type, you need to "apply"(*) the template: A<int>
.
If you write CLASS<PARAM>
, you're trying to apply a type to a type. This won't work. It's like trying to call a value 42(parameter)
, only on the type level.
So you need to specify that CLASS
is something which can be applied, that it's a template:
template <typename T> class CLASS
So, for reference, the complete solution is:
template <template <typename T> class CLASS, class PARAM>
void call(){
CLASS<PARAM>::do_something();
}
(*) A template is a function on type level: It takes one or more types, and returns a new type.