samedi 29 juin 2019

Function template parameter pack followed by template parameter and specialisation

Can a template parameter pack used in the definition of a function template, be followed by another template parameter, when that parameter is only given its required default value, in the definition; and not the declaration? Consider the following example:

template <typename ...Ts, typename T>
auto sz(Ts...);

template <typename ...Ts, typename T = int>
auto sz(Ts...) { return sizeof...(Ts); }

I find that GCC and Clang disagree on this (GCC gives a compilation error).

Aucun commentaire:

Enregistrer un commentaire