I am reading C++ Templates (2nd edition) and this is a snippet from the book:
template<typename... Ts, int N>
void f(double (&)[N], Ts... ps);
It is specified in the book that the declaration above is useless because N cannot be specified or deduced.
I am trying to understand why something like the following is an error:
double arr[1];
f<int, double, 1>(arr, 1, 2.0);
When I compile the snippet above, I get the error that there is no matching function for call to f.
Why does my specifying of the template arguments explicitly not match the arguments provided? Please help me understand this.
Aucun commentaire:
Enregistrer un commentaire