title: STL list - how to find a list element by its object fields
body: <p>I have a list:</p>
  
  <pre><code>list&lt;Unit *&gt; UnitCollection;
  </code></pre>
  
  <p>containing Unit objects, which has an accessor like:</p>
  
  <pre><code>bool Unit::isUnit(string uCode)
  {
      if(this-&gt;unitCode == uCode)
          return true;
      else
          return false;
  }
  </code></pre>
  
  <p>How do I search my UnitCollection list by uCode and return the corresponding element (preferably and iterator).</p>
  
  <p>In pseudo code it would look something like this:</p>
  
  <pre><code>for every item in my UnitCollection:
    if the unit.isUnit(someUnitIpass)
      do something
    else
      next unit
  </code></pre>
  
  <p>I have looked at the find() method, but i'm not sure you can pass a boolean method in instead of a searched item parameter if that makes sense.</p>