On Wednesday, August 11, 2010 10:52:30 bearophile wrote: > Jonathan M Davis: > > I think that's a total no-go because it would depend on program flow. > > You are of course right, it's the silly thing of the day. The #undef works > because it's not scoped. > > >You kind hide the variable creation inside another scope if you want this > >sort of behavior:< > > You can't do that, you can't modify a const variable in that way :-) > I will just keep two variables, one immutable and one mutable, as in the > first example. > > Later, > bearophile
Hits self on head. It's the whole issue with not being able to break out the referent from the reference declaring it const. Bleh. I wish that we'd found a better solution to that. In any case, then you should be able to use Rebindable to fix the problem. The other possibility is to just create a function to return the variable. That way, the const variable gets properly initialized rather than having to find a way to assign to it later. - Jonathan M Davis