Pass the vector by reference just like you already pass the Demo object.
istream& operator>> (std::istream& in, vector<double> & d);
std::istream& operator>> (std::istream& in, vector<double> & d)
Maybe read about References
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
hi,
i tried that before, but the problem with that is it will add all values into same vector test.
When you tried that and noticed that problem, are you sure that you did not have the d.clear(); call. Because the clear(), as you now have it, will empty the vector (of the tmp Demo object) so you'll not be accumulating the values in the vectors.
Maybe I'm not fully understanding you, because I'd still say that if you pass the vector by reference, you'll get what you want. I.e. I want to have the first double value in points, and the following two double values into unique vector test for each user
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395