Skip to Content
C++ High Performance - Second Edition
book

C++ High Performance - Second Edition

by Björn Andrist, Viktor Sehr
December 2020
Intermediate to advanced
544 pages
12h 45m
English
Packt Publishing
Content preview from C++ High Performance - Second Edition

8

Compile-Time Programming

C++ has the ability to evaluate expressions at compile time, meaning that values are already calculated when the program executes. Even though metaprogramming has been possible since C++98, it was initially very complicated due to its complex template-based syntax. With the introduction of constexpr, if constexpr, and recently, C++ concepts, metaprogramming has become much more similar to writing regular code.

This chapter will give you a brief introduction to compile-time expression evaluations in C++ and how they can be used for optimization.

We will cover the following topics:

  • Metaprogramming using C++ templates and how to write abbreviated function templates in C++20
  • Inspecting and manipulating types at compile ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ High Performance

C++ High Performance

Viktor Sehr, Björn Andrist

Publisher Resources

ISBN: 9781839216541Supplemental Content