If I have a vector of objects in one class which I want to change in another, I would try and pass all the information by reference.
What exactly do I need to pass by reference though? The vector? The objects? Both?
Essentially what I’m asking is: What is the difference between these?
vector&<object> blah; // A reference to a vector of objects?
vector<object&> blah; // A vector of references to objects?
vector&<object&> blah; // A reference to a vector of references to objects???
I’m not actually sure how referencing of array like containers work. Are these legal?
vector&<object>is a syntax error.vector<object&>is invalid, because a vector’s value type must be assignable.vector&<object&> blahis a syntax error.A reference to a vector is
vector<T>&.