I have a class that has a map. I need to find an iterator on a map, looking for a specific value, instad key. Using the member function predicate IsValueFound, I am trying to do this.
class A
{
public:
void findVal();
private:
int state;
map<int, int> exmap;
bool IsValueFound(pair<int key, int val> itr)
{
return state == itr.second;
}
};
void A::findVal
{
itr = find_if(exmap.begin, exmap.end, mem_fun1_ref(&A::IsValueFound));
}
I get compilation errors. I'm not sure what the syntax is for these functional adapters. Please, help.
EDIT: Sorry. Please ignore compilation errors other than finf_if stmt. I need to find find_if stmt first. Also, the code does not have support :(
source
share