I looked at a few examples and as far as I can tell I'm using the splice method correctly. However, when I run the program in debug mode under Visual C++, the call stack shows my call to splice eventually reaches this line where it crashes:
_Mynextiter = _Parent_proxy->_Myfirstiter;
The code:
for(std::list<Rect>::iterator i = rects.begin(); i != rects.end();)
{
if(i->isOverlapping(newRect))
{
Rect oldRect = (*i);
i = rects.erase(i);
std::list<Rect> & lr = oldRect.split(newRect);
//doesn't work either
//rects.splice(rects.begin(), lr, lr.begin(), lr.end());
rects.splice(rects.begin(), lr);
}
else i++;
}