David G
David G

Reputation: 96810

Why am I getting the error "parameter pack 'F' must be at the end of the template parameter list"

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

Upvotes: 1

Views: 584

Answers (1)

Mike Seymour
Mike Seymour

Reputation: 254451

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.

Upvotes: 3

Related Questions