[英]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
. 在
F
之后的列表末尾有另一个参数T
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.
不幸的是,这使得在同一模板中同时具有可变参数和默认参数变得尴尬。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.