Variadic templates provide the programmer with the ability to define a template function without needing to define all of the arguments. These are used heavily in wrapper functions as they prevent the wrapper from having to have any knowledge of the function's arguments, as shown in this example:
#include <iostream>template<typename... Args>void foo(Args &&...args){ }int main(void){ foo("The answer is: ", 42); return 0;}
As shown in the preceding example, we have created a foo function that can take any number of arguments. In this example, we use the universal reference notation, Args &&...args, which ensures the CV qualifiers and l-/r-valueness is preserved, meaning we can then use std::forward() to pass the variable arguments ...