Templating and Metaprogramming
Templates are a powerful tool in C++ that allows you to write generalized functions and classes, enabling them to depend on free parameters that are set whenever they are used. This is commonly used to create functions that can take arguments of any type as input.
With the C++11 standard, variadic templates were introduced. Variadic templates not only allows you to make typesafe variadic functions, but also enables templates to be used for metaprogramming: writing code that writes code.
In this course, we will give an introduction to programming with C++ templates and variadic functions. Topics include:
- Using templates to create type-independent functions and classes
- Creating variadic tempate functions - functions that take an arbitrary number of arguments, while being typesafe
- Metaprogramming with templates: make the compiler write some of your code
This course requires familiarity with the C++ programming language.