title: How to use lambda for std::find_if
body: <p>I am trying to use std::find_if to find an object that matches some criteria.  Consider the following:</p>
  
  <pre><code>struct MyStruct         
  {
      MyStruct(const int &amp; id) : m_id(id) {}                      
      int m_id;
  };
  ...         
  std::vector&lt;MyStruct&gt; myVector; //... assume it contains things
  
  MyStruct toFind(1);
  std::vector&lt;MyStruct&gt;::iterator i = std::find_if(myVector.begin(), myVector.end(), ???);
  </code></pre>
  
  <p>I am not sure what to put in the <code>???</code></p>
  
  <p>All the examples I have seen have a lambda that uses a hard-coded value to check for the ID.  What I want is to return the iterator/success only if the id of <code>toFind</code> matches the id of one of the items in the vector.  </p>
  
  <p>All the examples I have see don't show me how to pass the two parameters</p>
  
  <p>EDIT</p>
  
  <p>Additional info
  There are two different scenarios I have to use this for
  One in which there is an == operator for the struct
  and another in which there is no operator == for the struct - and i can't create one because the criteria for finding a match for this scenario is not as rigid as would be used for an equivalence operator.</p>
  
  <p>(And thanks to all who responded; I was able to use find() in one case and with your help was able to use find_if() for the other)</p>