title: using STL to find all elements in a vector
body: <p>I have a collection of elements that I need to operate over, calling member functions on the collection:</p>
  
  <pre><code>std::vector&lt;MyType&gt; v;
  ... // vector is populated
  </code></pre>
  
  <p>For calling functions with no arguments it's pretty straight-forward:</p>
  
  <pre><code>std::for_each(v.begin(), v.end(), std::mem_fun(&amp;MyType::myfunc));
  </code></pre>
  
  <p>A similar thing can be done if there's one argument to the function I wish to call.</p>
  
  <p>My problem is that I want to call a function on elements in the vector if it meets some condition.  <code>std::find_if</code> returns an iterator to the first element meeting the conditions of the predicate. </p>
  
  <pre><code>std::vector&lt;MyType&gt;::iterator it  = 
        std::find_if(v.begin(), v.end(), MyPred());
  </code></pre>
  
  <p>I wish to find <strong>all</strong> elements meeting the predicate and operate over them.</p>
  
  <p>I've been looking at the STL algorithms for a "<code>find_all</code>" or "<code>do_if</code>" equivalent, or a way I can do this with the existing STL (such that I only need to iterate once), rather than rolling my own or simply do a standard iteration using a for loop and comparisons.</p>