Complex Initialization for a Const Variable -- Herb Sutter
How do you declare a
const int variable when you have still have to do some computation to initialize it (so it shouldn't be const at first) but then want it be const after that?
Complex Initialization for a Const Variable
by Herb Sutter
On std-discussion, Shakti Misra asked:
> I have seen in a lot of places code like
int i; if(someConditionIstrue) { Do some operations and calculate the value of i; i = some calculated value; } use i; //Note this value is only used not changed. It should not be changed.
Olaf nailed it: The way to do it is with a lambda. ...


