title: The swap trick, stl
body: <p>Condsider we have a <code>std::vector</code> and want to compose it, make its size == capacity.</p>
  
  <pre><code>  vector&lt;int&gt; V;
    for(int i=0; i&lt;10; ++i)
    {
          V.push_back(i);
    }
    std::cout&lt;&lt;V.size()&lt;&lt;" "&lt;&lt;V.capacity()&lt;&lt;endl;
  </code></pre>
  
  <p>So the output for this is <strong>10 13</strong> (tho its implementation defined, I used VS2017).</p>
  
  <p>How to reallocate vector the way, in which size == capacity?</p>