[SOLVED] STL Map = operator not working in Creator 5.2.1. What version of C++ is this using?
-
I am preparing some code that compiles find in Xcode, but is complaining in QT. Here's the code:
@int TaskManager::cleanUpDeadTasks()
{
int deadgizmos = 0;
for (TaskMap::iterator it=m_tasks.begin(); it!=m_tasks.end();) {
if( !GizmoHandle::valid(it->second)) {
it = m_tasks.erase(it);
deadgizmos++;
}
else
++it;
}
return deadgizmos;
}@It doesn't like the code:
@it = m_tasks.erase(it);@
This is a normal STL reassignment of the iterator after the previous iterator was used to remove a element from a map. The last time we saw this was on Android. But after upgrading everything to c++ 11, it went away. Any suggestions?
-
After do some further looking, I found I can ad this to the .pro file:
@CONFIG += c++11@
-
[quote author="kloveridge" date="1396579537"]This is a normal STL reassignment of the iterator after the previous iterator was used to remove a element from a map. The last time we saw this was on Android. But after upgrading everything to c++ 11, it went away. Any suggestions?
[/quote]For completness, in C++ (no C++11) the map::erase doesn't not return anything: documentation
I've also been tricked a couple of times by this.