I am trying to find a way to specialize a template class in such a way that it can also handle template template (and template template template ...) parameters. Below is a simple code that demonstrates what I am trying to do. Since Foo
expect a type
as its template parameters, passing it a std::pair
or std::vector
causes compilation error. My impression is that in C++11/14/17 this is not natively supported. If this is really the case, and design recommendations are also more than welcome.
Thanks!
#include <utility>
template<typename...>
struct Foo{};
int main()
{
using Type1 = Foo<int> ;
using Type2 = Foo<std::pair<int, char>>;
// using Type3 = Foo<int, char, std::pair>; // => does not compile
// error : expected a type, got 'pair'
}