title: C++: std::vector::resize vs. "normal" allocation
body: <p>In the code example for <code>std::transform</code>, there is an example with code like this:</p>
  
  <pre><code>std::vector&lt;int&gt; foo;
  std::vector&lt;int&gt; bar;
  
  //add some elements to foo
  
  bar.resize(foo.size());
  
  //store elements transformed from foo's in bar
  </code></pre>
  
  <p>And I was wondering whether</p>
  
  <pre><code>std::vector&lt;int&gt; bar;    
  bar.resize(foo.size());
  </code></pre>
  
  <p>was any different from</p>
  
  <pre><code>std::vector&lt;int&gt; bar(foo.size());
  </code></pre>
  
  <p>and if so, how?</p>