News for hackers. Stuff that matters.
Re:Just how constexpr is C++20’s std:string? by eesmith on Saturday September 09, 2023 @12:31AM (#37442308)
My config file paths have either been constant (".dotfile") or required run-time information that could not be constexpr'ed. I don't see how constexpr would be useful.

Then again, I am primarily a Python and C programmer, so there is likely some underlying reasoning I'm missing.

Re:Just how constexpr is C++20’s std:string? by cshokie on Saturday September 09, 2023 @07:23PM (#37451289)
const std::string foo = “.dot file”;

in C++ cannot change after construction, but is not compile time constant. This means that it has to run some code and allocate some memory at runtime.

In contrast constexpr is fully compile time and ends up in the read only portion of the binary. No code code execution or allocations necessary.