I thought the following code would work but it crashes when the target widget is at the end of the vector.
for(std::vector<AguiWidget*>::iterator it = children.begin();
it != children.end(); ++it)
{
if((*it) == widget)
it = children.erase(it);
}
I want it to go through and delete any instance it finds of widget. I understand this method is N^2 but since this is event driven it is fine. I just don't know why this should fail. When it does, 'it' == widget.
Thanks