home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,680 of 33,346   
   Francis Glassborow to bob   
   Re: remove   
   21 Nov 11 14:28:55   
   
   7c653f24   
   From: francis.glassborow@btinternet.com   
      
   On 21/11/2011 18:13, bob wrote:   
   > What is the best way to convert this to C++?  I'm concerned about the   
   > lack of iterator remove:   
   >   
   >          for (iterator  i = particles.iterator();   
   > i.hasNext();) {   
   >              final Particle p = i.next();   
   >              p.move();   
   >              p.timeleft--;   
   >   
   >              if (p.timeleft == 0) {   
   >                  i.remove();   
   >              }   
   >          }   
   >   
   >   
   It would help if you specified what language the above code has been   
   written in. Yes, I can guess but as I do not know all the languages it   
   might be in, it would be a guess.   
      
   BTW, I do not think the above should have been accepted by the moderator   
   (fine if the language of the code is specified but not without)   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca