sizeof...
OperatorWhen we need to know how many elements there are in a pack, we can use the sizeof...
operator. Like sizeof
(§ 4.9, p. 156), sizeof...
returns a constant expression (§ 2.4.4, p. 65) and does not evaluate its argument:
template<typename ... Args> void g(Args ... args) {
cout << sizeof...(Args) << endl; // number of type parameters
cout << sizeof...(args) << endl; // number of function parameters
}