I have this multimap inside a Bar class, with an unsigned long and a reference to the Foo class.
class Bar
{
//etc.
struct map_sort
{
bool operator()(const unsigned long& e1, const unsigned long& e2) const
{
return (e2 < e1);
}
};
std::multimap<const unsigned long,const Foo&, map_sort> m_map;
find_and_erase(const unsigned long var1, const Foo& var2);
}
And now I want to retrieve all the values from the multimap and erase some.
void Bar::find_and_erase(const unsigned long var1, const Foo& var2)
{
auto it = m_map.begin();
for (it=m_map.begin(); it!=m_map.end(); ++it)
{
const unsigned long first = (*it).first;
const Foo& second = (*it).second;
if((first == var1) && (second == var2)) //<----ERROR No Match for operator==
m_map.erase(it);
}
}
Question
How can I compare the (second == var2) ?
(What I want is to find all entries from a multimap, and delete the ones on the find_and_erase() function, that matches the function argument. Don't know if there is an easier solution for this)
Aucun commentaire:
Enregistrer un commentaire