In a variadic template declared as template <typename… Args> void log(Args… args), what does sizeof…(Args) give?
Correct answer D. The number of template arguments in the pack
Explanation
sizeof... is a special operator that yields the number of elements in a parameter pack as a compile-time constant of type std::size_t. It has nothing to do with byte sizes, which ordinary sizeof measures. For log(1, 2.0, "x") it gives 3, which is useful for static checks or for sizing arrays built from the pack.
Answer checked How we write and check questions
Discussion