I've been in a couple of situations where I want the counter i
to be const-safe. Below is a banal example of what I mean. Is there a way to achieve this?
for (int i = 0; i < 10; ++i)
{
++i; // I don't want this to be allowed
cout << i << endl;
}
Aucun commentaire:
Enregistrer un commentaire