When vectors are allocated, do they use memory on the heap or the stack?
vector<Type> vect; will allocate the vector, i.e. the header info, on the stack, but the elements on the free store (“heap”). vector<Type> *vect = new vector<Type>; allocates everything on the free store. vector<Type*> vect; will allocate the vector on the stack and a bunch of pointers on the free store, but where these point is … Read more