title: Using erase-remove_if idiom
body: <p>Let's say I have <code>std::vector&lt;std::pair&lt;int,Direction&gt;&gt;</code>.</p>
  
  <p>I am trying to use erase-remove_if idiom to remove pairs from the vector. </p>
  
  <pre><code>stopPoints.erase(std::remove_if(stopPoints.begin(),
                                  stopPoints.end(),
                                  [&amp;](const stopPointPair stopPoint)-&gt; bool { return stopPoint.first == 4; }));
  </code></pre>
  
  <p>I want to delete all pairs that have .first value set to 4.</p>
  
  <p>In my example I have pairs:</p>
  
  <pre><code>- 4, Up
  - 4, Down
  - 2, Up
  - 6, Up
  </code></pre>
  
  <p>However, after I execute erase-remove_if, I am left with:</p>
  
  <pre><code>- 2, Up
  - 6, Up
  - 6, Up
  </code></pre>
  
  <p>What am I doing wrong here?</p>