Variadic templates, parameter pack and its discussed ambiguity in a parameter list

后端 未结 1 1161
孤街浪徒
孤街浪徒 2020-12-30 07:39

In this question, I\'ll refer to my previous question.

In that question, I found that the following is not valid:

template

        
相关标签:
1条回答
  • 2020-12-30 08:25

    In the class template, a prospective template argument list C<a,b,c,d,e,f> needs to match

    template<typename T, typename... A, typename S>
    

    in which ...A is just floating in a parameter list.

    But in the specialization, what needs to be matched is not the list of template variabled but rather the pattern:

    C<T(A...), S>
    

    which is easy because the A... is delimited.

    So in the template specialization, the list of parameters is just an inventory of symbols, some scalar and some parameter packs, which will appear in a pattern.

    0 讨论(0)
提交回复
热议问题