![]() |
Home | Libraries | People | FAQ | More |
C++ programming sometimes involves repeating lists of template or function parameters. Such repetition is troublesome, because it tends to be done manually, which means that the maximum number of parameters is bound into the design of the program making it difficult to configure. Automating the repetition using extra linguistic tools introduces another set of problems.
The C preprocessor is part of the C++ language and can manipulate and generate tokens. Unfortunately the C preprocessor is also a very low level macro processor. In particular, it doesn't directly support repetition or recursion. Fortunately it is possible to perform finite repetition and recursion using a library of preprocessor primitives.
The PREPROCESSOR library provides facilities for C preprocessor metaprogramming. Preprocessor metaprogramming makes it possible to generate function and template parameter lists and make libraries configurable through preprocessor definitions.
The original idea of passing two extra parameters to REPEAT, which makes it possible to create preprocessor code on top of it, was due to Aleksey Gurtovoy. The invokeable IDENTITY macro was also invented by him. He also suggested the name for the library. Many thanks to Aleksey for his insights!
Thanks to everyone who participated in the review: David Abrahams, Beman Dawes, Ronald Garcia, Douglas Gregor, Aleksey Gurtovoy, Jeremy Siek, and Daryle Walker.
Thanks to Chris Little and Mat Marcus for providing help with MWCW.
The PREPROCESSOR library has been developed by Vesa Karvonen.
© Copyright Housemarque Oy 2001
Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.
Updated: 30 Nov 2001