title: How to find an object from a list based on object member value
body: <p>In C++ I want to find an object in the list if the object member matches the specific value.</p>
  
  <pre><code>class gate{
   public: 
    std::string type;
  } 
  
  class netlist {
    std::list&lt;gate *&gt; gates_;
    void identify_out_gate();
  }
  </code></pre>
  
  <p>Now I want to find a particular gate from the list based on its type. I am using the following:</p>
  
  <pre><code>netlist::identify_out_gate()
  {
      for (std::list&lt;gate *&gt;::const_iterator out_gate = gates_.begin(); out_gate != gates_.end(); ++out_gate)
      {
          if((*out_gate)-&gt;type == "output")
          {
              //do something......
          }
      }
  }
  </code></pre>
  
  <p>but I want to know if I can use something like find or find_if and how?</p>