title: Erasing an element from 2D vector c++
body: <p>I have a unsymmetrical vector in 2D.</p>
  
  <pre><code>vector&lt; vector&lt;int&gt; &gt; Test
  </code></pre>
  
  <p>where Test = </p>
  
  <pre><code>         2 4 6 5 7 
           6 5 7 9 10
           5 9 10
           9 10
  </code></pre>
  
  <p>I am reading the row 1 and if any element of this is present in other rows then delete it.
  for eaxmple.. After reading row 1, i have to remove 6, 5, and 7 from other rows.</p>
  
  <p>However, It is not working </p>
  
  <p>Here is the code i am trying</p>
  
  <pre><code>Test[i].erase(Test[i].begin()+j);
  </code></pre>
  
  <p>where i = row and j is col.</p>
  
  <p>My code is :</p>
  
  <pre><code>for (i =0; i &lt; Test.size();i++)
          {
          for (j=0; j &lt; Test[i].size();j++)
                  {
                  // removed repeated element
                  if (i &gt;0)
                          {
                          Test[i].erase(Test[i].begin() +j);
                          }
                  }
          }
  </code></pre>