Variadic Templates
In Chapter 2B, No Ducks Allowed - Templates and Deduction, we introduced generic programming and templates. Templates have been part of C++ before C++03. Prior to C++11, templates were limited to a fixed number of arguments. In some cases, where a variable number of arguments was required, it was necessary to write a template for each variant of argument numbers required. Alternatively, there were variadic functions like printf() that could take a variable number of arguments. The problem with variadic functions is that they are not type safe as access to the arguments was through type casts via the va_arg macro. C++11 changed all that with the introduction of variadic templates where a single template can take an arbitrary number of arguments. C++17 improved the writing of variadic templates by introducing the constexpr if construct that would allow the base case template to be merged with the "recursive" template.
The best approach is to implement a variadic...