[C++, TCL] - Iterator Q

Started by
-1 comments, last by Striken 16 years, 3 months ago
Hey all, Anyone know how to nicely perform this logic, with Tree Container Library and STL?

tcl::unique_tree<GameObj*>::pre_order_iterator io = _objects.pre_order_begin();

while ( io != _objects.pre_order_end() ) {
  //pseudo start
  GameObj *o = (*io);
  if ( o->doUpdate() ) {
    //if the game object needs to be updated, update and continue to iterate down the tree
    o->Update();
  } else {
    //Otherwise, skip the update for this and it's childen    
    io = _objects.next_iterator_of_level(io?);
    continue;
  }

  //pseudo end
  io++;
}


Thanks!
- Teach a programmer an answer, he can code for a day. Show a programmer the documentation, he can code for a lifetime.

This topic is closed to new replies.

Advertisement