I have a scenario where I have a vector of Class objects. Actually, I have something like this:
class Dummy{};
vector<*Dummy> dummyObjects;
I want to pass return this collection of Dummy Objects to some other class through a function call. I am confused whether I should return a pointer to this vector or should I just simply return the vector instance? Should I use a shared pointer instead because that would me from the pain of freeing up the allocated memory? I wanted to know what all the scenarios should be considered here and what would be the best approach in this situation?
Aucun commentaire:
Enregistrer un commentaire