The Variadic Template Parameter Pack

Learn how to use variadic template parameter packs in C++, including constructing them and creating functions like make_string().

The variadic template parameter pack enables programmers to create template functions that can accept any number of arguments.

An example of a function with a variadic number of arguments

If we were to create a function that makes a string out of any number of arguments without variadic template parameter packs, we would need to use C-style variadic arguments (just like printf() does) or create a separate function for every number of arguments:

Get hands-on with 1400+ tech skills courses.