Variadic templates are arguably the most profound change in the core language brought about by C++0X. Curiously, however, the C++ community still tiptoes carefully around them: variadic templates enjoyed less coverage than features such as “auto” or lambdas. Part of the reason is that more popular features simplify expression of existing designs, which makes said features easier to understand and use. Variadic templates, however, not only simplify design and use of advanced libraries such as Boost MPL, but also enable a host of new uses.

This class provides a solid coverage of variadic fundamentals, including typelists, the archetypal “safe printf” mechanics, and tuple construction and access. It also discusses more advanced uses, such as structured argument lists.

A function with a structured argument list accepts variadic arguments that have a structure to them, most often expressible as a regular expression. For example, a function may accept argument lists of the form (string, string, int, string, int, string, …), i.e. two strings followed by any number of int and string pairs. Structured argument lists are very useful in supporting implementation of fast, expressive algorithms and for defining a variety of useful abstractions.

Reply to this post if there are any particular aspects of variadic templates you’d like to see covered. Also don’t forget there are only a few seats left, so register soon if you haven’t. See you all soon!