N
neilsolent
Hi
Is it valid to iterate over a std::map like this:
//////////////
map<string, msg*>::iterator it;
for (it = m_myMap.begin(); it != m_myMap.end(); it++)
(*it).second->Check();
////////////////
... where the function Check() may add or remove elements from m_myMap.
I am worried that this may cause a crash. Should I make a copy of
m_myMap first ?
thanks
Neil
Is it valid to iterate over a std::map like this:
//////////////
map<string, msg*>::iterator it;
for (it = m_myMap.begin(); it != m_myMap.end(); it++)
(*it).second->Check();
////////////////
... where the function Check() may add or remove elements from m_myMap.
I am worried that this may cause a crash. Should I make a copy of
m_myMap first ?
thanks
Neil