I was wondering what would be the best way to accomplish something like this...
// Iterating through a list
if ( foo ) {
RemoveBar( it );
}
void RemoveBar( std::list< Type >::iterator it ) {
it = listName.erase( it );
...// Other stuff related to cleaning up the removed iterator
}
I don't think pass by value will work here. Obviously what I want to do is stay in the correct iterator position when I call RemoveBar. Is pass by reference the best alternative?