title: Erasing row in 2D Vector - segmentation error
body: <p>I'm new to C++, and am learning vectors now. I'm trying to delete a row from a 2D vector, but so far all my attempts have been resulting in a segmemtation error. This is the piece of code I've been trying out -</p>
  
  <pre><code>vector&lt;vector&lt;int&gt; &gt; myVector;
  ...
  vector&lt;vector&lt;int&gt; &gt;::iterator row = myVector.begin();
  while(row!=myVector.end())
  {
      if((*row)[0] == -1)
          myVector.erase(row);
      else
          row++;
  }
  </code></pre>
  
  <p>myVector is a 2D vector that contains values such as:</p>
  
  <pre><code> 1 0
  -1 1
   2 1
  -1 0 ...
  </code></pre>
  
  <p>I need to delete any row whose first element is -1.</p>
  
  <p>I've tried using <code>myVector.erase(myVector.begin() + row2delete)</code> but that's giving me a core dump too. Am I doing something wrong? Thank you for the help!</p>