Bonjour,
Voilà lorsque je parcours un vecteur à partir d'un 'iterator' je n'ai pas trouvé comment savoir à quel id on se situe. Je compte dans la boucle avec un compteur j, mais ça fait pas beau, comment on fait ? Merci d'avance

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

   vector<shared_ptr<CDynamic_Coin> >::iterator it_checkpoint = game.VCheckpoint.begin();

   int j = 0;
   for(; it_checkpoint != game.VCheckpoint.end(); ++it_checkpoint) {

      //...

      game.checkpoint  = j;

      //...
   
      ++j;
   }