title: shrink_to_fit() vs swap trick
body: <p>I have a game where certain game objects spawn all at once and then despawn as they get destroyed/killed. The game objects are elements in an <code>std::vector</code>, and I'd like to minimize memory usage. I'm used to the swap trick,</p>
  
  <pre><code>std::vector&lt;gameObject&gt;(gameObjectVector.begin(), gameObjectVector.end()).swap(gameObjectVector);
  </code></pre>
  
  <p>but I noticed the inbuilt <code>shrink_to_fit()</code> from C++11. However, it has linear complexity while the swap trick is constant. Isn't the swap trick superior in every way? </p>