title: Push_back 1D Vector as Row into 2D Vector Array
body: <p>I'm trying to define the values of a 'row' or 1D vector and then push_back that row into a 2D vector.  I've tried a couple different things that don't throw errors but also don't seem to work.  Code below:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  using std::vector;
  
  #define HEIGHT 5
  #define WIDTH 3
  
  // 2D VECTOR ARRAY EXAMPLE
  
  int main() {
  vector&lt;vector&lt;double&gt; &gt; array2D;
  vector&lt;double&gt; currentRow;
  
  // Set up sizes. (HEIGHT x WIDTH)
  // 2D resize
  array2D.resize(HEIGHT);
  for (int i = 0; i &lt; HEIGHT; ++i)
  {
    array2D[i].resize(WIDTH);
  }
  // Try putting some values in
  array2D[1][2] = 6.0; // this works
  array2D[2].push_back(45); // this value doesn't appear in vector output.  Why?
  
  // 1D resize
  currentRow.resize(3);
  
  // Insert values into row
  currentRow[0] = 1;
  currentRow[1] = 12.76;
  currentRow[2] = 3;
  
  // Push row into 2D array
  array2D.push_back(currentRow); // this row doesn't appear in value output.  Why?
  
  // Output all values
  for (int i = 0; i &lt; HEIGHT; ++i)
  { 
    for (int j = 0; j &lt; WIDTH; ++j)
      {  
          std::cout &lt;&lt; array2D[i][j] &lt;&lt; '\t';
    }
    std::cout &lt;&lt; std::endl;
   }
   return 0;
  }
  </code></pre>