I know the difference between const
and constexpr
, this is not a question answered by simply re-stating their differences.
Rather I would like to know practical use-cases where you would prefer const
over constexpr
variables.
Cases like const references or const methods, etc. are obviously excluded as const
does something entirely different for them.
The only case I can think of are values that should never change but are initialized from a value unknown at compile-time (read from a file, received from a socket, etc.).
I have looked at this but it did not answer my question.