Andre Poenitz <[EMAIL PROTECTED]> writes: | On Mon, Jul 14, 2003 at 10:05:51PM +0300, Martin Vermeer wrote: | > void BranchList::remove(string const & s) | > { | > List::iterator it = list.begin(); | > List::iterator end = list.end(); | > for (; it != end; it++) { | > if (it->getBranch() == s) list.erase(it); | > } | > } | > | | Optically, this should be | | if (it->getBranch() == s) | list.erase(it); | | Theoretically, I'd expect this to be undefined behaviour as 'it' is | invalid after its 'pointee' is erased. | | Practically, there is a std::list<>::remove_if(Pred) somewhere.
yes. -- Lgb