I'm trying to learn how to use C++ properly and I've run into a dilemma.
If I have a class which has a private vector and I want to allow a client of this class to iterate over the objects in the vector how should this be done?
Should I write a public function which return a reference to the vector? Should I return an iterator some how?
Any snippets of code would be appreciated. Obviously no examples are required for the case where a reference is returned.
I would like to know what the most correct way of doing this is and why.