I have a class that takes a template template parameter:
template <template <typename> class F>
class A {};
And another templated class with an inner templated class:
template <typename T>
class B {
public:
template <typename U>
class C {};
};
I want to be able to use C
as the template template parameter for A
in a templated context:
template <typename T>
using D = A<B<T>::C>;
However, this results in an error message:
"template argument for template template parameter must be a class template or type alias template"
I am assuming that I am missing some magic incantation of typename
and template
in the declaration of D
, but I cannot figure it out for the life of me and the error message isn't particularly useful.
The error message complains that B<T>::C
is not a template, thus it doesn't match the template template parameter of A
.
You need to use template
keyword to tell the compiler that the dependent name B<T>::C
(which depends on the template parameter T
) is a template.
template <typename T>
using D = A<B<T>::template C>;
// ~~~~~~~~