title: reserve() - data() trick on empty vector - is it correct?
body: <p>As we know, std::vector when initialized like <code>std::vector vect(n)</code> or <code>empty_vect.resize(n)</code> not only allocates required amount of memory but also initializes it with default value (i.e. calls default constructor). This leads to unnecessary initialization especially if I have an array of integers and I'd like to fill it with some specific values that cannot be provided via any vector constructor.</p>
  
  <p>Capacity on the other hand allocates the memory in call like <code>empty_vect.reserve(n)</code>, but in this case vector still is empty. So <code>size()</code> returns <code>0</code>, <code>empty()</code> returns <code>true</code>, <code>operator[]</code> generates exceptions.</p>
  
  <p>Now, please look into the code:</p>
  
  <pre><code>{ // My scope starts here...
  
      std::vector&lt;int&gt; vect;
      vect.reserve(n);
      int *data = vect.data();
  
      // Here I know the size 'n' and I also have data pointer so I can use it as a regular array.
      // ...
  
  } // Here ends my scope, so vector is destroyed, memory is released.
  </code></pre>
  
  <p>The question is if "so I can use it as array" is a safe assumption?</p>
  
  <p>No matter for arguments, I am just curious of above question. Anyway, as for arguments:</p>
  
  <ol>
  <li>It allocates memory and automatically frees it on any return from function</li>
  <li>Code does not performs unnecessary data initialization (which may affect performance in some cases)</li>
  </ol>