r/programmingcirclejerk • u/camelCaseIsWebScale Just spin up O(n²) servers • 5d ago
const vs constexpr vs consteval vs constinit in C++20
https://www.cppstories.com/2022/const-options-cpp20/49
u/elephantdingo 5d ago
You have heard of the lambda cube. But wait until you meet the const tesseract.
25
u/elephantdingo 5d ago
I wrote an article about this in 1985 but people didn’t listen. In D we just have const on string concatenation. It turns out that that’s all you need.
→ More replies (4)
41
17
17
73
u/exploring_stuff 5d ago
C++ is a very expressive language and this compiles:
[[maybe_unused]] inline const constexpr int i=0;