Use Compile-Time Vectors and Strings with Constexpr
Explore how C++20 expands constexpr capabilities to include STL vectors and strings for compile-time evaluation. Understand the use of constexpr constructors, destructors, and algorithms, enhancing your code's efficiency by shifting computations from runtime to compile time.
We'll cover the following...
We'll cover the following...
C++20 allows the use of constexpr in several new contexts. This provides improved efficiency, in that these things may be evaluated at compile time, instead of run time.
How to do it
The specification includes the ability to use string and vector objects in constexpr context. It's important to note that these objects may not themselves be declared constexpr ...