template<typename... TArgs> struct List { };
template<template<typename...> class> struct ListHelper;
template<typename T, typename... TArgs> struct ListHelper<List<T, TArgs...>> { };
^
/*Error: Template argument for template template parameter
must be a class template or type alias template*/
What's wrong? I'm using clang++ SVN.
A template template parameter expects the template, not an instantiation of it. This:
template<typename T, typename... TArgs> struct ListHelper<List> { };
// only the template itself ^^^^
If you want to pass List<T,TArgs...>
, which is a class, you'd need
template<typename T> struct ListHelper;
You have a template template parameter. You must pass a template as its argument. You instead pass a template instantiation as its argument - which is a concrete class, not a template (all its parameters are bound).
Consider:
template <template<typename> typename X>
class WantsTemplate {};
template <typename>
class ATemplate {};
WantsTemplate<ATemplate> wt1; // OK
WantsTemplate<ATemplate<int> > wt2; // not OK
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