In the area of vectors, I'm able to reserve() and then push_back just fine, but I thought just push_back would automatically increase the capacity. Whenever I just do push_back the capacity increases more then it should (supposed to be 14 but becomes 18. Anyways, here's the code.
using namespace std;
reserve() is a hint to the vector to let it know how many elements you intend it to hold - it allocates memory for such but doesn't instantiate any obejcts.
push_back() instantiates an object in the next available reserved space, or if there is no more reserved space it reserves more and either copy- or move-constructs the existing elements into the new memory.
When the vector reserves memory itself automatically, it may reserve more than just one additional slot - this is intended as an optimization so that it does not have to re-allocate every time you add another element.