top | item 37451289

(no title)

cshokie | 2 years 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.

discuss

order

No comments yet.