title: How does compiler decide capacity of a vector?
body: <p>I am implementing my very own vector container in C++. To do so, firstly I am trying to fully understand how vectors work, and I've come across a problem while doing so.</p>
  <p>According to C++ reference, vectors have both a size (the number of elements in the vector) and a capacity (the maximum amount of items the vector can store before reallocation is required). My first question is the following: when a vector is instanciated, how does the compiler ¨decide¨ the capacity of the vector? Is it a random number?</p>
  <p>I have a second question as well. I have done several tests where I instanciate a vector with, let's say, X elements. In every single case, the capacity of the vector is X as well. However, if I pop back some elements, the size is reduced but the capacity remains the same. Does this always happen? I mean, are the capacity and size always the same when the vector is instanciated? If not, why do you think this is happening to me?</p>
  <p>P.S. I compile with <code>clang++</code></p>