1

I have code that uses a variadic template and I'm trying to understand where to put the ellipsis. In the below code I put them, like the error says, at the end of the template parameter list. But I still get errors. What am I doing wrong?

template <typename T> struct S {

    void operator << (const T &) {}

};

template <template <typename, typename...> class ... F, typename T = int>
struct N : S<F<T>> ... {};

prog.cpp:10:82: error: parameter pack 'F' must be at the end of the template parameter list

David G
  • 94,763
  • 41
  • 167
  • 253

1 Answers1

3

You have another parameter, T, at the end of the list after F. As the error message says, the variadic pack must come at the end. Unfortunately, that makes it awkward to have both variadic and defaulted parameters in the same template.

Mike Seymour
  • 249,747
  • 28
  • 448
  • 644