【问题标题】:Why am I getting the error "parameter pack 'F' must be at the end of the template parameter list"为什么我收到错误“参数包'F'必须在模板参数列表的末尾”
【发布时间】:2012-12-01 18:58:16
【问题描述】:

我有使用可变参数模板的代码,我正在尝试了解省略号的放置位置。在下面的代码中,我将它们放在模板参数列表的 end 中,就像错误所说的那样。但我仍然得到错误。我做错了什么?

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

【问题讨论】:

    标签: c++


    【解决方案1】:

    F 之后的列表末尾还有另一个参数T。正如错误消息所说,可变参数包必须在最后。不幸的是,这使得在同一个模板中同时拥有可变参数和默认参数很尴尬。

    【讨论】:

      猜你喜欢
      • 2023-04-07
      • 2016-12-02
      • 2021-03-06
      • 1970-01-01
      • 2022-01-18
      • 2022-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多