We reduced a portion of code we cannot find the right syntax for to a minimal example.
Let's assume the following definitions (worry not about the "why" ;)
template <class>
class Element
{};
template <template <class> class>
class Client
{};
template <class>
struct TemplatedProvider
{
template <class T>
using element_template = Element<T>;
};
Now, with C++11 onward, we can use either a class template or a type alias template to instantiate the Client
template. The following function compiles just fine:
void fun()
{
Client<Provider::element_template> client;
Client<TemplatedProvider<int>::element_template> clientBis;
}
But we cannot find the proper syntax in the following case, when the template argument given to Client
is a dependent name:
template <class T>
void templatedFun()
{
Client<TemplatedProvider<T>::element_template> client;
}
Clang (tested with 3.6) is emitting the following compilation error:
template argument for template template parameter must be a class template or type alias template
Can we fix this syntax ?
It has to be:
template <class T>
void templatedFun()
{
Client<TemplatedProvider<T>::template element_template> client;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With