Use Compile-Time Vectors and Strings with Constexpr
Learn to use compile-time vectors and strings with constexpr.
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
, but they may be used in a compile-time context:
Get hands-on with 1400+ tech skills courses.