Re:Just how constexpr is C++20’s std:string?
by kccqzy on Friday September 08, 2023 @04:43PM
(#37439159)
But what can you do with that string list afterwards? You can't store it anywhere to be accessed at run time, can you?
[ Parent
| on HN ]
Re:Just how constexpr is C++20’s std:string?
by Chabsff on Friday September 08, 2023 @05:05PM
(#37439417)
The important part is that all the intermediate strings used during the computation are constexpr, to guarantee that the work happens during compilation.
Also, constexpr symbols can be demoted to regular const as needed by the compiler if necessary, such as when getting a pointer to one. constexpr doesn't mean "compile-time only", it means "compile-time compatible"