title: Inserting a Row into a 2D Vector(vector of vectors)
body: <p>Relatively new to the C++ scene.  Anyways, I have a list:  </p>
  
  <blockquote>
    <p>1 5 6<br>
        3 1 2<br>
        5 3 4 7<br>
        6 2<br>
        7 3</p>
  </blockquote>
  
  <p>I am attempting to fill out the numbers that are missing (in this case, 2 and 4).  This list is being inputted as a vector of vectors.  That's working fine.  My function to insert numbers where they need to be is not.  This is my code:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;vector&gt;
  #include&lt;string&gt;
  #include&lt;fstream&gt;
  #include&lt;sstream&gt;
  
  using namespace std;
  
  int main()
  {
  vector&lt; vector&lt;int&gt; &gt; vec1;
  
  vector&lt;int&gt; tempVec;
  
  
  string str = "";
  stringstream ss;
  int temp = 0;
  
  ifstream iFile;
  //  iFile.open("E:\\COMP 220\\SCC sample input.txt");
  iFile.open("E:\\SCC sample input2.txt");
  
  
  if (iFile.is_open()) //Inputs file
  {
      cout &lt;&lt; "File is open!\n";
  
      getline(iFile, str);
      while (!iFile.eof())
      {
          int z = 0;
          stringstream ss(str);
          while (ss &gt;&gt; temp)
          {
              tempVec.push_back(temp);
              cout &lt;&lt; tempVec[z] &lt;&lt; " ";
              z++;
          }
          vec1.push_back(tempVec);
          cout &lt;&lt; endl;
          tempVec.clear();
          getline(iFile, str);
      }
  }
  
  int count = 0;
  while (count &lt; vec1.size() - 1)
  {
      if (vec1[count][0] != vec1[count + 1][0] - 1)
      {
          tempVec.clear();
          tempVec.push_back(vec1[count][0] + 1);
          vec1.insert(count, tempVec);
      }
      else
          count++;
  }
  
  return 0;
  }
  </code></pre>
  
  <p>When finished, I was hoping the code would resemble:</p>
  
  <blockquote>
    <p>1 5 6<br>
    2<br>
    3 1 2<br>
    4<br>
    5 3 4 7<br>
    6 2<br>
    7 3</p>
  </blockquote>
  
  <p>Any ideas?  The current problem is a compiler error with:<br>
  vec1.insert(count, tempVec);</p>