We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Your New Mental Model of constexpr - Jason Turner - CppCon 2021
Discover the power of constexpr in C++ and learn how to move code to compile time to achieve faster execution and smaller binary sizes, with examples of complex programs that can benefit from this approach.
- The key to moving code to compile time is to identify the parts of your program that can be evaluated at compile time and focus on moving those parts.
- constexpr is not metaprogramming, it’s just a way to execute code at compile time.
- The presenter has moved 10% of his program to compile time.
- The constexpr continuum is the path to moving parts of your program to compile time.
- Ben’s question about Turing completeness was answered in the affirmative.
- The presenter demonstrated that it’s possible to move 40% of a program to compile time.
- moving code to compile time can bring benefits such as faster execution and smaller binary sizes.
- There are limitations to moving code to compile time, such as the difficulty of working with static variables.
- The presenter used a Commodore 64 emulator as an example of a complex program that can benefit from moving code to compile time.
- constexpr can be used with standard library functions and classes, but it’s not always simple.
- The presenter showed an example of a function that can be moved to compile time using constexpr, and presented benefits such as faster execution and smaller binary sizes.
- The presenter emphasized the importance of identifying the parts of a program that can be evaluated at compile time and focusing on moving those parts.
- The presenter showed how to use constexpr to split a string into multiple lines and center them.
- The presenter demonstrated that it’s possible to move 60% of a program to compile time.
- The presenter explained that constexpr can be used for programming graphical resources.
- The presenter demonstrated how to use constexpr to generate a font table at compile time.
- The presenter explained the importance of testing constexpr code.
- The presenter demonstrated how to use constexpr to generate a vector at compile time.
- The presenter explained that constexpr can be used for graphic scaling.
- The presenter demonstrated how to use constexpr to rotate a screen buffer at compile time.
- The presenter emphasized the importance of identifying the parts of a program that can be evaluated at compile time and focusing on moving those parts.
- The presenter showed an example of a font that can be generated at compile time using constexpr.
- The presenter demonstrated how to use constexpr to split a string into multiple lines and center them.
- The presenter explained the importance of using constexpr with static variables.
- The presenter emphasized the importance of identifying the parts of a program that can be evaluated at compile time and focusing on moving those parts.