Is there some ninja trick to make a variable constant after its declaration?
One solution would be to factor all of the mutation code into a lambda expression. Do all of the mutation in the lambda expression and assign the result out to a const int in the method scope. For example void SomeFunction(const int p1) { auto calcA = [&]() { int a = p1; a *= … Read more