title: C++ - STL vector question
body: <p>Is there any way to make <code>std::vector</code> faster on <code>reserving + resizing</code>?</p>
  
  <p><em>I would like to achieve the performance which would be somewhat equivalent to plain C arrays.</em></p>
  
  <p><strong>See the following code snippets:</strong></p>
  
  <pre><code>TEST(test, vector1) {
     for (int i = 0; i &lt; 50; ++i) {
        std::vector&lt;int&gt; a;
        a.reserve(10000000);
        a.resize(10000000);
     }
  }
  
  TEST(test, vector2) {
     for (int i = 0; i &lt; 50; ++i) {
        std::vector&lt;int&gt; a(10000000);
     }
  }
  
  TEST(test, carray) {
     for (int i = 0; i &lt; 50; ++i) {
        int* new_a = new int[10000000];
        delete[] new_a;
     }
  }
  </code></pre>
  
  <p>First two tests are two times slower (<code>4095 ms vs 2101 ms</code>) and, obviously, that happens because <code>std::vector</code> is nulling the elements in it. <em>Any ideas on how this could be avoided?</em></p>
  
  <p>Or probably there is some standard <em>(boost?)</em> container that implements a fixed-size and heap-based array?</p>
  
  <p>Thank you</p>