title: Why does this work? std::set find with search key and custom comparator
body: <p>I don't understand why the following works (although I'm glad that it works!):</p>
  
  <p>I can define an <code>std::set</code> of Objects with a custom comparator.  This custom comparator works by comparing some member variable of the two Objects being compared.
  <strong>BUT</strong> then I can use <code>set</code>'s  <code>.find(x)</code>  function   with  <code>x</code> being of the member variable type rather than an object itself, and it works!</p>
  
  <p>Here is an extremely simplified example:</p>
  
  <p>my_class.h</p>
  
  <pre><code>class my_class   //just hold an integer
  {
      public:
        int an_int;
  
      my_class(int new_int) : an_int(new_int)
      { }
  
  
      //compare instances of this class by comparing their integers...
      struct compare_instances   
      {    
        bool operator() (const my_class &amp;a, const my_class &amp;b) const
        {
          return a.an_int &lt; b.an_int;
        }
      };
  };
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>...
  std::set&lt;my_class, my_class::compare_instances&gt; my_class_set;
  my_class_set.insert( my_class(18) );
  my_class_set.insert( my_class(7)  );
  my_class_set.insert( my_class(22) );
  
  std::set&lt;my_class, my_class::compare_instances&gt;::const_iterator found_it
                    = my_class_set.find(18);
   std::fprintf(stderr, "found_it-&gt;an_int = %d\n", found_it-&gt;an_int); 
  </code></pre>
  
  <p>Output:  "found_it->an_int = 18"  !!!!!!</p>
  
  <p>I would have expected the above code to not compile, and for the compiler to yell at me that " <code>18</code> is not of type <code>my_class</code> ".  But it doesn't...</p>
  
  <p>Shouldn't arguments to <code>.find</code>  be of same type as the elements of the <code>set</code> itself?  That's what the documentation seems to say...</p>