title: What happens under the hood of vector::push_back memory wise?
body: <p>My question is regarding the effect of <code>vector::push_back</code>, I know it adds an element in the end of the vector but what happens underneath the hood?</p>
  
  <p>IIRC memory objects are allocated in a sequential manner, so my question is whether <code>vector::push_back</code> simply allocates more memory immediately after the vector, and if so what happens if there is not enough free memory in that location? Or perhaps a pointer is added in the "end" to cause the vector to "hop" to the location it continues? Or is it simply reallocated through copying it to another location that has enough space and the old copy gets discarded? Or maybe something else?</p>