Paper Presentation & Seminar Topics: Variadic Templates in C++

Variadic Templates in C++

Abstract:(seminar) Generic functions and classes typically accept a fixed number of type arguments. However, gen- eric functions and classes that accept a variable number of type arguments have proven to be a very useful, even though there is no support for this feature in C++. Numerous foundational libr- aries rely on clever template and preprocessor tricks to emulate such variable-length templates. By several measures these emulations are inad- equate. This paper describes variadic templates, an extension to the C++ language that signify- cantly improves existing implementations of widely used C++ libraries in terms of code size, quality of error diagnostics, compilation speed, and generality. Furthermore, variadic templates enable new applications, such as type-safe implementations of functions like printf, and improved support for generic mixin classes. Variadic templates are part of the upcoming ISO C++ Standard, dubbed C++0x, and we have integrated variadic templates into the GNU C++ compiler.