isn't this enough to check whether the map contains i...Code:it2=mymap.find(i);
if(it2!=mymap.end())
{
}
It doesn't work for me...
Am i wrong?
If yes ,wat shud be the snippet
Printable View
isn't this enough to check whether the map contains i...Code:it2=mymap.find(i);
if(it2!=mymap.end())
{
}
It doesn't work for me...
Am i wrong?
If yes ,wat shud be the snippet
And what is the type of i? Does it implement ordering correctly?
That's the correct way to check if an item is in the map. If it's "not working" then either you are mistaken about the item being/not being present, or the type of the object you are storing in the map does not correctly implement a partial ordering.