Driver::~Driver() { AutoCritSec acsDriverList(m_csDriverList,true); DRIVERLIST::iterator it = m_DriverList.begin(); for(;it!=m_DriverList.end();it++) {
The correct erase idiom for associative containers is as follows:
for (auto it = container.begin(); it != container.end() /* not hoisted */; /* no inc. */ ) { if (delete_condition) { container.erase(it++); } else { ++it; } }