Your New Mental Model of constexpr - Jason Turner - CppCon 2021

https://cppcon.org/ https://github.com/CppCon/CppCon2021 --- In my experience as a trainer, YouTuber, and speaker, I find that many people have a mistaken impression of what constexpr is and for what it is suited. I see people over-complicate constexpr by conflating it with meta programming and template-related topics. Students will often fail to recognize where and when constexpr could be used. Experts will get concerned about the "contract" you are making with the user of your library by marking functions as constexpr. In this talk, I will present a mental model for how you should consider constexpr. I will explain what constexpr is (less mechanically and more metaphorically), give practical applications for constexpr, and help you figure out where constexpr fits into your application or library. In the most straightforward sense, constexpr is moving work from runtime to compile-time. This mental model that I will present will ask, "what work would you rather do at compile-time?" We will find this answer by looking at constexpr as a continuum. On one end of the continuum is the use case of moving a runtime fixed-size vector into a compile-time fixed-size constexpr array, and on the far end is executing your entire program at compile-time and simply outputting the results at runtime. --- Jason Turner Host of C++Weekly    / jasonturner-lefticus  , Co-host of CppCast http://cppcast.com, Co-creator and maintainer of the embedded scripting language for C++, ChaiScript http://chaiscript.com, and author and curator of the forkable coding standards document http://cppbestpractices.com. I'm available for contracting and onsite training. --- Videos Filmed & Edited by Bash Films: http://www.BashFilms.com YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk *--*

Law of Demeter: A Practical Guide to Loose Coupling - Kris Jusiak - CppCon 2021
▶︎

Law of Demeter: A Practical Guide to Loose Coupling - Kris Jusiak - CppCon 2021

Branchless Programming in C++ - Fedor Pikus - CppCon 2021
▶︎

Branchless Programming in C++ - Fedor Pikus - CppCon 2021

Understanding The constexpr 2-Step - Jason Turner - C++ on Sea 2024
▶︎

Understanding The constexpr 2-Step - Jason Turner - C++ on Sea 2024

Back to Basics: C++ API Design - Jason Turner - CppCon 2022
▶︎

Back to Basics: C++ API Design - Jason Turner - CppCon 2022

The Cost of Concurrency Coordination with Jon Gjengset
▶︎

The Cost of Concurrency Coordination with Jon Gjengset

Back To Basics: The Special Member Functions - Klaus Iglberger - CppCon 2021
▶︎

Back To Basics: The Special Member Functions - Klaus Iglberger - CppCon 2021

Back to Basics: Templates in C++ - Nicolai Josuttis - CppCon 2022
▶︎

Back to Basics: Templates in C++ - Nicolai Josuttis - CppCon 2022

Back to Basics: Master the static, inline, const, and constexpr C++ Keywords - Andreas Fertig
▶︎

Back to Basics: Master the static, inline, const, and constexpr C++ Keywords - Andreas Fertig

Building the PERFECT Linux PC with Linus Torvalds
▶︎

Building the PERFECT Linux PC with Linus Torvalds

The Joy of C++26 Contracts - Myths, Misconceptions & Defensive Programming - Herb Sutter
▶︎

The Joy of C++26 Contracts - Myths, Misconceptions & Defensive Programming - Herb Sutter

"Clean" Code, Horrible Performance
▶︎

"Clean" Code, Horrible Performance

Back to Basics: RAII and the Rule of Zero - Arthur O'Dwyer - CppCon 2019
▶︎

Back to Basics: RAII and the Rule of Zero - Arthur O'Dwyer - CppCon 2019

Keynote: The Real Problem of C++ - Klaus Iglberger
▶︎

Keynote: The Real Problem of C++ - Klaus Iglberger

Turing Award Winner: Disagreeing with Google, Postgres, Future Problems | Mike Stonebraker
▶︎

Turing Award Winner: Disagreeing with Google, Postgres, Future Problems | Mike Stonebraker

Trump Brags About His Brain, Crowd Size & Pool, CBS Fires Scott Pelley & Don Jr's Honeymoon Video
▶︎

Trump Brags About His Brain, Crowd Size & Pool, CBS Fires Scott Pelley & Don Jr's Honeymoon Video

Back to Basics: Templates (part 1 of 2) - Bob Steagall - CppCon 2021
▶︎

Back to Basics: Templates (part 1 of 2) - Bob Steagall - CppCon 2021

C++ Weekly - Ep 432 - Why constexpr Matters
▶︎

C++ Weekly - Ep 432 - Why constexpr Matters

From C++ Templates to C++ Concepts - Metaprogramming: an Amazing Journey - Alex Dathskovsky
▶︎

From C++ Templates to C++ Concepts - Metaprogramming: an Amazing Journey - Alex Dathskovsky

C++ Code Smells - Jason Turner
▶︎

C++ Code Smells - Jason Turner

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup
▶︎

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup