Chapter 9. Crossing the Compile-Time/Runtime Boundary

Remember runtime execution? We realize it’s been a while, having spent so long in the stratospheric world of compile-time programming, but we’re going to ask you to join us back on solid ground now. Ultimately, any interesting program has to do something at runtime. This chapter is about crossing the boundary between compile time and runtime C++—the “ozone layer,” if you will—so that our metaprograms can make a difference in the lives of real users. There are probably an infinite number of ways to make that journey in C++, but some have proven themselves to be more useful than others; we’ll cover a few of the most commonly used techniques next.

9.1 for_each

The simplest STL algorithm ought ...

Get C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.