Understanding The constexpr 2-Step: From Compile Time To Run Time

Jason Turner

⏱ 60 minute session
11:00-12:00, Wednesday, 3rd July 2024

C++20 enabled both std::vector and std::string for constexpr usage. However, this simple case does not compile:

constexpr std::vector<int> data{1,2,3,4,5};

If we cannot create constexpr strings and vectors, then what good are they for constexpr use?

This talk will cover the "constexpr two-step." A method of getting data of unknown size generated at compile time into the runtime world while minimizing binary sizes in the process.

🏷 constexpr

Jason Turner

Jason has 2 decades of C++ experience and is a regular conference speaker, developer, and trainer. He has been publishing weekly C++ videos on his YouTube channel, C++ Weekly, since 2016.