(Common Lispers, Schemers:)
Fancy-shmancy OO-reinvents-the-world word for the substandard facilities for macro expansion available in C++ through use of templates.
(C++ weenies:)
An impressive set of template-based tools to generate code at compile time. Probably initiated by Todd Veldhuizen, who used metaprogramming to write library code for Blitz++. "Thanks" to templates, C++ compilation is a Turing complete activity (in other words, barring the implementation restrictions which tie up every C++ compiler in knots when it tries to compile templates 25-deep, the set of legal C++ programs is not recursive).

Template metaprogramming typically uses partial specialization of templates to achieve its goals. When instantiating, the more specific template definition wins. What was not initially obvious (to the ISO C++ committee!) was that this is usable as a compile time conditional. Coupled with recursion (a template may instantiate in term of another instantiation of itself), we get a complete programming language. But it's not C++, and it doesn't look like C++. Instead, think of some weird interpreter running inside the C++ compiler during template expansion.

See my writeups Int<bits> and C++: Computing Fibonacci numbers at compile time for examples. See fibonaci's C++: checking units at compile time for an actually useful example. Or go read Modern C++ Design for a full toolbox of C++ metaprogramming techniques, and when to use them.

Log in or register to write something here or to contact authors.