Consider a standard for loop:
for (int i = 0; i < 10; ++i)
{
// do something with i
}
I want to prevent the variable i
fr
Couldn't you just move some or all the content of your for loop in a function that accepts i as a const?
Its less optimal than some solutions proposed, but if possible this is quite simple to do.
Edit: Just an example as I tend to be unclear.
for (int i = 0; i < 10; ++i)
{
looper( i );
}
void looper ( const int v )
{
// do your thing here
}