title: C++ Erase vector element by value rather than by position?
body: <pre><code>vector&lt;int&gt; myVector;
  </code></pre>
  
  <p>and lets say the values in the vector are this (in this order):</p>
  
  <pre><code>5 9 2 8 0 7
  </code></pre>
  
  <p>If I wanted to erase the element that contains the value of "8", I think I would do this:</p>
  
  <pre><code>myVector.erase(myVector.begin()+4);
  </code></pre>
  
  <p>Because that would erase the 4th element. But is there any way to erase an element based off of the value "8"?  Like:</p>
  
  <pre><code>myVector.eraseElementWhoseValueIs(8);
  </code></pre>
  
  <p>Or do I simply just need to iterate through all the vector elements and test their values?</p>