I have a scenario where I want to store a number of objects of a particular class(dummy) type in a vector.
vector<Dummy> dummyObjects;
My collection may end up containing >5k objects. Now, this vector needs to be accessed by another class (Dummy_2). The class Dummy_2 is just for display. So, my doubt was whether I should return a pointer to this vector to Dummy_2 or should I just return the vector object which will as we know create a copy of this vector? If we return a pointer to this vector, do I need to worry about de-allocating the memory later once my program ends or would one of the smart pointer would help me to overcome this de-allocating of the memory?