title: Using find_if on map to find by value
body: <p>I have a class which has a map. I need to find iterator in map by searching for a particualar value, instad of the key. Using a member function predicate IsValueFound, am trying this.</p>
  
  <pre><code>class A
  {
  public:
    void findVal();
  private:
   int state;
   map&lt;int, int&gt; exmap;
   bool IsValueFound(pair&lt;int key, int val&gt; itr)
   {
     return state == itr.second;
   }
  };
  
  void A::findVal
  {
    itr = find_if(exmap.begin, exmap.end, mem_fun1_ref(&amp;A::IsValueFound));
  }
  </code></pre>
  
  <p>Iam getting compilation errors. Iam not sure whats the syntax for these function adaptors. Please help.</p>
  
  <p>EDIT: Sorry. Please neglect the compilation errors arising other than from finf_if stmt. I need to get find_if stmt corrected first. Also the code doesn't have boost :(</p>