Meta C++: an extension layer for multi-stage generative metaprogramming

By: Yannis Lilis, Anthony Savidis


Generative metaprogramming is a powerful mechanism for reuse through code manipulation, adaptation and composition. Its practicing is complex, involving development demands similar to any actual system. In C++, metaprogramming is currently practiced with templates, requiring a functional programming style that is in contrast to the imperative object-oriented nature of the main language. Thus, metaprograms bear little resemblance to normal programs, and involve different programming approaches in their development, effectively disabling any possibility for design or code reuse between them. In this paper, we propose MetaC++, an extension layer supporting multi-stage generative metaprogramming for C++, offering the full-range of language constructs for implementing compile-time metaprograms and allowing them to share development practices with normal programs. We present its design and implementation, and outline the importance of such an extension to C++ through a number of advanced application scenarios.


Metaprogramming, Generative Programming, Compile-Time Metaprogramming, Multi-Stage Languages, Language Implementation.

Cite as:

Yannis Lilis, Anthony Savidis, “Meta C++: an extension layer for multi-stage generative metaprogramming ”, Journal of Object Technology, Volume 18, no. 1 (March 2019), pp. 1:1-44, doi:10.5381/jot.2019.18.1.a1.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn

The JOT Journal   |   ISSN 1660-1769   |   DOI 10.5381/jot   |   AITO   |   Open Access