title: Initialization of vector of vector is very slow
body: <p>I have a vector of vectors and I am trying to initialize it as follows:</p>
  
  <pre><code>vector&lt;vector&lt;float&gt; &gt; matrix(numberOfRows, vector&lt;float&gt; (numberOfCols));
  </code></pre>
  
  <p>But this line lasts about 0.89 where the numberOfRows and numberOfCols are:</p>
  
  <pre><code>const uint32_t numRows = 10000;
  const uint32_t numCols = 20000;
  </code></pre>
  
  <p>Whereas initializing dynamics array with the following code take 0.04 sec to execute:</p>
  
  <pre><code>float **matrix = new float*[numberOfRows];
  for (size_t i = 0; i &lt; numberOfRows; ++i)
      matrix[i] = new float[numberOfCols];
  </code></pre>
  
  <p>Am I doing something wrong is there any faster way to initialize that vector?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>As for the questions:</p>
  
  <p>I used g++-4.5 to test using O3 optimization level with default standard.</p>