- Use
const
for variables that shouldn’t change andconstexpr
for values that can be computed at compile time. This improves readability and can optimize performance.
Prefer const and constexpr
My WordPress Blog
My WordPress Blog
const
for variables that shouldn’t change and constexpr
for values that can be computed at compile time. This improves readability and can optimize performance.