-
stl map erase
I have this function which works fine in visual studio:
btw this is code for a c++ stl map, where map is Life and the iterator is di.
Code:
void structure::deletion_process()
{
for (di = Life.begin(); di != Life.end(); /* nothing here */)
{
if (di->second.getDelete())
{
di =Life.erase(di);
}
else
{
++di;
}
}
}
but when i run it in linux i get this error:
error: no match for operator=
-
map::erase() does not return an iterator. It returns nothing unless you call the version that erases all occurrences of a specific value, which returns a count. You've been using an implementation of erase() specific to visual studio, apparently.