title: Erase elements in a vector of struct according to a property value
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3424962/where-is-erase-if">Where is erase_if?</a>  </p>
  </blockquote>
  
  
  
  <p>I have structure as follows:</p>
  
  <pre><code>struct V {
   int x;
   int y;
  }:
  </code></pre>
  
  <p>and I have an stl vector of struct elements</p>
  
  <pre><code>vector&lt;struct V&gt; v1;
  </code></pre>
  
  <p>I would like to erase from the vector all elements having the attribute y less than a certain value. </p>
  
  <p>How could I please do that using <code>std::remove_if</code> by defining a predicate associated to the structure.</p>
  
  <p>That is the predicate that I defined but that does not seem to be correct.</p>
  
  <pre><code>struct less_than_value
  {
   const int value;
  
   bool operator()(const struct V p) const
   {
      return p.y &lt; value;
   }
  };
  </code></pre>