CSC/ECE 517 Spring 2013/ch1 1h jc
Metaprogramming in statically typed languages
Introduction
What is metaprogramming
Metaprogramming in statically typed languages
Implementation
Exposing the internals of the compiler as an API
Program transformation system
Metaprogramming using Scheme
Common Uses
Pre-generate static data at compile time
One common use of metaprogramming in statically typed languages is to write programs that will pre-generate tables of data for use at runtime.
A practicable approach to pre-generate static data at compile time in C++ is template metaprogramming. Template metaprograms consist of class templates operating on numbers and/or types as data. Algorithms are expressed using template recursion as a looping construct and class template specialization as a conditional construct. Template recursion involves the direct or indirect use of a class template in the construction of its own member type or member constant.