title: std::string as a key in std::map using a compare operator
body: <p>I'm trying to use a std::string as a key in a std::map however, i'm unable to find() correctly. My code is somewhat complicated and large so this is a small program that demonstrates the problem I'm having. If someone could tell me why this doesn't work, i'd be very grateful.</p>
  
  <p>Thanks.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string&gt;
  #include &lt;map&gt;
  
  struct comparer
  {
      public:
      bool operator()(const std::string x, const std::string y)
      {
           return x.compare(y)==0;
      }
  };
  
  int main(int argc, char *argv[])
  {
      std::map&lt;std::string, int, comparer&gt; numbers;
      numbers.insert(std::pair&lt;std::string,int&gt;("One",1));
      numbers.insert(std::pair&lt;std::string,int&gt;("Two",2));
      numbers.insert(std::pair&lt;std::string,int&gt;("Three",3));
      numbers.insert(std::pair&lt;std::string,int&gt;("Four",4));
      numbers.insert(std::pair&lt;std::string,int&gt;("Five",5));
  
  
      std::map&lt;std::string, int, comparer&gt;::iterator it=numbers.find("Three");
      if(it!=numbers.end())
          printf("The number is %d\n",(*it).second);
      else
          printf("Error, the number is not found\n");
  }
  </code></pre>