title: Why can't this std::find compare these objects
body: <p>Usually when I do an std::find I'll put a predicate as the third argument, but this time I thought I'd do it differently, I don't understand why it doesn't work.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  
  struct RenderJob
  {
      RenderJob() {};
      int renderJob_ID;
      bool operator==(RenderJob&amp; rhs) { return rhs.renderJob_ID == this-&gt;renderJob_ID; }
  };
  
  int main()
  {
      RenderJob foo;
      RenderJob foo2;
      foo == foo2; // Works
  
      std::vector&lt;RenderJob&gt; renderJobs;
  
      std::find(renderJobs.begin(), renderJobs.end(), foo); // Doesn't work
  }
  </code></pre>
  
  <blockquote>
    <p>binary "==" no operator found  which takes a left-handed operand of
    type RenderJob (or there is no acceptable conversion)</p>
  </blockquote>
  
  <p>Edit:: Well thanks for the answers. Here are some examples of why it fails</p>
  
  <pre><code>    RenderJob foo;
      RenderJob foo2;
      foo == foo2; // Works
  
      std::vector&lt;RenderJob&gt; renderJobs;
  
      std::vector&lt;RenderJob&gt;::const_iterator constit = renderJobs.begin();
  
      *constit == foo2;  // Doesn't work
  </code></pre>
  
  <p>Even simpler as an illustration:</p>
  
  <pre><code> const RenderJob* pToRenderJob;
  
  *pToRenderJob == foo2;  // This fails because the pointed to 
                          // object is const, and cannot call the 
                          // operator== function because the actual function
                          // definition is not const. 
  </code></pre>
  
  <p>If it were the other way around:</p>
  
  <pre><code>foo2 == *pToRenderJob; // This would fail because the 
                          // operator==(RenderJob&amp;) the actual argument 
                          // is not const. Very subtle rules
  </code></pre>