簡體   English   中英

為什么我收到錯誤“參數包'F'必須位於模板參數列表的末尾”

[英]Why am I getting the error “parameter pack 'F' must be at the end of the template parameter list”

我有使用可變參數模板的代碼,我試圖了解省略號的放置位置。 在下面的代碼中,我把它們放在模板參數列表的末尾 ,就像錯誤所說的那樣。 但我仍然會遇到錯誤。 我究竟做錯了什么?

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

F之后的列表末尾有另一個參數T 正如錯誤消息所示,可變參數包必須在最后。 不幸的是,這使得在同一模板中同時具有可變參數和默認參數變得尷尬。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM