I can initialize a variable at compile time using constexpr
, but this makes the variable immutable (i.e. const
).
I want a variable that is guaranteed to be initialized at compile time, but that I can still mutate/modify at run-time.
I can initialize a variable at compile time using constexpr
, but this makes the variable immutable (i.e. const
).
I want a variable that is guaranteed to be initialized at compile time, but that I can still mutate/modify at run-time.
i think there should be non const and compile time evaluated variable.
Take a look at C++20's constinit
.