title: emplace_back is faster than allocate once + move in c++11?
body: <p>I have two fuctions: </p>
  
  <p>f2 - first allocate memory , then move data.</p>
  
  <p>f - deallocate + move = emplace_back.</p>
  
  <p>I am trying to understand what is faster and better to use in terms of performance and code quality?</p>
  
  <pre><code>void f2(const std::vector&lt;std::string&gt;&amp; users) {
      std::vector&lt;std::pair&lt;std::string, int&gt;&gt; userOccurancies(users.size());
  
      auto userOcIt = userOccurancies.begin();
      for (const auto &amp; user : users) {
          userOcIt-&gt;first = std::move(user);
          userOcIt-&gt;second = 0;
          userOcIt++;
      }
  }
  
  void f(const std::vector&lt;std::string&gt;&amp; users) {
      std::vector &lt; std::pair&lt;std::string, std::size_t&gt;&gt; userCount;
      userCount.reserve(users.size());
  
      for (auto&amp; user : users) {
          userCount.emplace_back(user, 0);
      }
  }
  </code></pre>
  
  <p>As for performance I tried to check it with MS VS2019 profiler but it always gives me different results if a swap calls of these funcions with each other: <code>f2(users);f(users);</code> and <code>f(users);f2(users);</code> gives different call tree.</p>
  
  <p>Can you help me?</p>
  
  <p>What is faster and better to use in terms of performance and code quality?</p>
  
  <p>I use only c++11.</p>