Code:
typedef std::list<int> intList;
typedef intList::iterator myListIter;

intList myList;
myListIter iter = myList.begin();

while (1)
{
	if (iter == myList.end())
	{
		myList.push_back(2);
		myList.push_back(4);
		myList.push_back(6);
	}
}
On the first time round the loop, myList is empty. On the second time round, 3 items have been added to the list. Therefore 'iter' is no longer at the list end. However, the test if (iter == myList.end()) passes, so 3 more ints get added to the list.

Is there a way to 'reset' an iterator (or to have some kind of intelligent iterator) so that, if items get added to (or removed from) the list, the iterator keeps track of the new begin() and end() ?