Sign in to follow this  
Striken

[C++, TCL] - Iterator Q

Recommended Posts

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this