I'm going through a book and I've looked this up, but don't understand why (or maybe I have to) use reserve. Since it is a vector why is there a need to reserve memory? Is it just a way so that it doesn't double the memory off the heap or something (me guessing)?
here is the code I am looking at:
Farm(int spaces = 1);
//.... more stuff goes here
//=============Constructor: reserve used below=========
m_farmAnimal.reserve(spaces) // <=== reserve?