|
ABSTRACT
Generic functions and classes accepting a variable number of type arguments have proven to be a very useful, but missing, feature of C++. Numerous foundational libraries rely on clever template and preprocessor tricks to emulate such variadic templates. By several measures these emulations are inadequate. This paper describes how C++ can be extended with variadic templates, significantly improving 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. We have implemented variadic templates as an extension of a production quality C++ compiler.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Peter Dimov. The Boost Bind library. http://www.boost.org/libs/bind/bind.html, August 2001.
|
| |
2
|
|
| |
3
|
|
| |
4
|
Dan Marsden Joel de Guzman. Boost Fusion. http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html, 2006.
|
| |
5
|
Douglas Gregor. Boost.Function. Boost. http://www.boost.org/doc/html/function.html.
|
| |
6
|
Aleksei Gurtovoy and David Abrahams. The Boost C++ metaprogramming library. www.boost.org/libs/mp1, 2002.
|
| |
7
|
Pete Becker. Working draft, standard for programming language C++. Technical Report N2009=06-0079, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C++, April 2006.
|
| |
8
|
Douglas Gregor. Variadic templates for GCC. http://www.osl.iu.edu/~dgregor/cpp/variadic-templates.html, August 2006.
|
| |
9
|
Vesa Karvonen and Paul Mensonides. The Boost Preprocessor library, http://www.boost.org/libs/preprocessor/doc/index.html, July 2001.
|
| |
10
|
Douglas Gregor. {libstdc++ patch} trl::bind, take 2. GNU libstdc++ mailing list, March 2005. http://gcc.gnu.org/ml/libstdc++/2005--03/msg00367.html.
|
| |
11
|
|
| |
12
|
Howard E. Hinnant, Dave Abrahams, and Peter Dimov. A proposal to add an rvalue reference to the C++ language. Technical Report N1690=04-0130, ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming language C++, September 2004. http://www.open-std.org/jtcl/sc22/wg21/docs/papers/2004/n1690.html.
|
| |
13
|
Joel de Guzman. The Spirit C++ parser framework. http://spirit.sourceforge.net, 2006.
|
| |
14
|
|
| |
15
|
Todd L. Veldhuizen. C++ templates are Turing complete, www.osl.iu.edu/~tveldhui/papers/2003/turing.pdf, 2003.
|
| |
16
|
Matt Austern. (Draft) Technical Report on Standard Library Extensions. Number N1660=04-0100 in ISO C++ Standard Committee 2004--07 mailing, 2004.
|
| |
17
|
|
| |
18
|
ECMA. C# Language Specification, June 2005. http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf.
|
| |
19
|
David A. Hall. Variable number of generic params. Java bug report 6261297: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6261279, 2005.
|
| |
20
|
Walter Bright. D programming language. http://www.digitalmars.com/d/, 2006.
|
| |
21
|
|
 |
22
|
|
 |
23
|
|
| |
24
|
Samuel Krempp. The Boost Formatambda library. http://www.boost.org/libs/format, 2002.
|
| |
25
|
H. Abelson , R. K. Dybvig , C. T. Haynes , G. J. Rozas , N. I. Adams Iv , D. P. Friedman , E. Kohlbecker , G. L. Steele, Jr. , D. H. Bartley , R. Halstead , D. Oxley , G. J. Sussman , G. Brooks , C. Hanson , K. M. Pitman , M. Wand, Revised Report on the Algorithmic Language Scheme, Higher-Order and Symbolic Computation, v.11 n.1, p.7-105, August 1998
[doi> 10.1023/A:1010051815785]
|
| |
26
|
Douglas Gregor, Gary Powell, and Jaakko Järvi. Typesafe variable-length function and template argument lists. Number N1483=03-0066 in ISO C++ Standard Committee Post-Oxford mailing, April 2003.
|
| |
27
|
Douglas Gregor, Jaakko Järvi, and Gary Powell. Variadic templates. Number N1603=04-0043 in ISO C++ Standard Committee Pre-Sydney mailing, February 2004.
|
| |
28
|
Douglas Gregor, Jaakko Järvi, and Gary Powell. Variadic templates: Exploring the design space. Number N1704=04-0144 in ISO C++ Standard Committee Pre-Redmond mailing, September 2004.
|
|