C++11 introduced variadic templates
template <typename... Args>
void foo(Args... params) {
cout << sizeof...(Args) << endl;
}
What are the names of Args and params? I know that one of them (at least?) is called a variadic template pack but which is it? And what is the other called?
Partially quoting the FDIS, §14.5.3:
So in your example,
typename... Argsis a template parameter pack (and consequently also a parameter pack)Args... paramsis a function parameter pack (and consequently also a parameter pack)sizeof...(Args)is a pack expansion whereinArgsis the pattern (an identifier in this context).