Header image
Photo of Jason Turner

Jason Turner

Jason has 2 decades of C++ experience and is a regular conference speaker, developer, and trainer. He is host of the YouTube channel C++ Weekly and co-host of CppCast, the first podcast for C++ developers.

Applied constexpr

full day workshop
Intermediate

By now we all know now that constexpr can be used to generate virtually anything at compile time. But what does this mean for our normal day to day C++ work? How, why, and most importantly where do we use constexpr to get the most out of it in our quest for clean efficient C++?

Introduction

  • History and background of C++
  • Changes from C++11 to C++14
  • Changes from C++14 to C++17
  • Limitations of constexpr
  • Exercises for demonstrating what can or cannot be constexpr

Preparing for constexpr

  • Developing a constexpr mindset
  • General advantages to types that fully support constexpr
  • Disadvantages to constexpr

Using constexpr

  • What is actually required to be executed at compile time?
  • Compile-time data verification
  • Creating compile-time resources
  • Utilizing compile-time resources
  • Compile-time sorting
  • Compile-time testing

Conclusion

  • Maintaining constexpr support
  • Current compiler support status
  • The future of constexpr for C++20