I know some people think STL rules, but of the game programmers ive talked to about it, nobody seems to really use it. IMO this is a case in point where STL isn't so hot; It's unclear the right way to do a simple operation - something you could have coded yourself in just a few minutes (: On Sun, Mar 2, 2008 at 9:16 PM, Chris Nystrom <cnystrom@xxxxxxxxx> wrote: > On 3/2/08, David Olsen <jolynsbass@xxxxxxxxx> wrote: > > Hi guys, > > I'm just double checking on how to use iterators in my game. I have a list > > of words, and the potential to re-arrange their order. Is this the correct > > manner in which to do so with iterators: > > > > a vector called "word", with iterator #1 (iter1) and iterator #2 (iter2). > > iter2 is always the next vector element after iter1. (iter2 = iter1++) > > > > in the event that I need to switch the two words, does this c++ code work? > > > > word.insert(iter1,*iter2); > > word.erase(iter2); > > > > will this give me the expected result? or will I erase what's pointed to by > > iter1, since I just added something in front of it, essentially putting it > > in the place where iter2 has been pointing? > > I do not know. Can you write a little test program to see if it works? > > Chris > > -- > E-Mail: Chris Nystrom <cnystrom@xxxxxxxxx> > Saving the world from web programming. > http://www.newio.org - AIM: nystromchris > > > --------------------- > To unsubscribe go to http://gameprogrammer.com/mailinglist.html > > > --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html