Hacker News new | ask | show | jobs
by cshokie 1008 days ago
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.