Passing an object by const reference means we can't modify any of it's members. But suppose the object contains a vector<string>
member. How do we write const methods to read the contents of the vector<string>
member assuming that a vector<string>::iterator
member is also needed and must be updated after every read to point to the next element in the vector?
Is this possible, or is there another method in this situation? That is, don't modify the contents of the passed by const reference object, but the object should be able to update it's internal state (i.e. next element in the vector to be read).