I a class with a member variable, which is
multiset < pair<TrainType, map<string, set<tm>>>> m_oTrainGraphic;
TrainType is enum. I am inserting some elements in the m_oTrainGraphic
container.I have a method, which takes a parameter of type tm
, and the thing i wan't to do is to delete those elements which have element of type tm
which is equal to the parameter of the method.Here is the method.
bool DeleteTrain(const tm& time)const
{
for (auto it = m_oTrainGraphic.begin(); it != m_oTrainGraphic.end(); ++it)
{
for (auto iter = it->second.begin(); iter != it->second.end(); ++iter)
{
for (auto i = iter->second.begin(); i != iter->second.end(); ++i)
{
if (i->tm_hour == time.tm_hour
&& i->tm_min == time.tm_min)
{
m_oTrainGraphic.erase(it);
}
}
}
}
}
The problem is that i get error when trying to erase it.Thanks in advice !