简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM