variadic templates code example
Example: variadic templates
template
void Foo(Agrs*... arguments);
template
class A;
/* Variadic templates can be used to allow a multitude of variations
of a class or function to be compiled without having to explicitly
state what the required amount of template parameters are.
In order to use the parameter pack you need to unpack it. This can be
done through C++17 fold expressions or using recursion:*/
template
void Foo(Arg* arg)
{
// do something.
}
template
void Foo(Arg* arg, Args*... args)
{
Foo(arg);
Foo(args);
}