CppCon 2021 has ended
Back To Schedule
Tuesday, October 26 • 10:30am - 11:30am
Back to Basics: const and constexpr

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
It is a virtue to program as const as possible in modern C++. Your program is by design way more type safe, has fewer concurrency issues, and runs with high probability faster.
Const has many flavors in modern C++. Thanks to const, you can protect a value against mutation. With constexpr, you can initialize and compute values at compile time. Thanks to conteval, a computation can only run at compile time. In the end, constinit empowers you to initialize a modifiable value at compile time.

Let me show you in my lecture how you can initialize a value with constexpr and constinit in a thread-safe way. Let me show you how const and constexpr help you protect values from mutation and, therefore, make them immune to data races. Finally, let me show you how constexpr and consteval empowers you to improve the performance of your program and get functions that are by design easy to test, easy to maintain, and implicitly thread-safe.

ALL TALK SESSIONS CAN BE ACCESSED FROM THE MAIN LOBBY: https://cppcon.digital-medium.co.uk/

avatar for Rainer Grimm

Rainer Grimm

C++ trainer, Modernes C++
I've worked as a software architect, team lead, and instructor since 1999. In 2002, I created company-intern meetings for further education. I have given training courses since 2002. My first tutorials were about proprietary management software, but I began teaching Python and C... Read More →

Tuesday October 26, 2021 10:30am - 11:30am MDT