I'm working on a very basic game and I have a std::list collection of objects that pertain to my game. I declared it as:
std::list<Target> targets;
When I iterate over it, using
for (std::list<Target>::iterator iter = targets.begin(); iter != targets.end(); iter++) {
Target t = *iter;
t.move();
}
My objects aren't updating on the GUI. However, replacing the iterating loop with a targets.front().move()
, my one object moves correctly. I think this is because I am not iterating over the collection using pointers. Can anyone explain how that is done? Thanks.