map嵌套删除元素 报错Unhandled exception in *:0xC0000005 Access Violation
map嵌套删除元素 报错Unhandled exception in *:0xC0000005 Access Violation
在线程里面执行了下面的语句后报错:
if(0 == time(NULL)%7)STL?map 删除map erase.() 线程 map
{
for(pointer = map_tidtocid.begin(); pointer!= map_tidtocid.end(); pointer++)
{
for(it = pointer->second.begin(); it != pointer->second.end(); it++, i++)
{
printf(">>>>ServerStage::map tid=%d--cid=%d--delaytime=%03d--i=%d\r\n", pointer->first, it->first, time(NULL)-it->second, i);
if(8 < time(NULL)-it->second)
{
pointer->second.erase(it);//超时后删除cid
printf(">>>>Delete tid=%d--cid=%d--time=%d--i=%d\r\n", pointer->first, it->first, time(NULL)-it->second, i);
}
}
}
}