I have a void function with a vector as an argument. The function fills the vector, but I want to use this vector as the argument in a second function. When I try to use it in the second function, the vector is empty.
For example:
It was all working fine, but I had to drastically alter my code and that's when this problem appeared. I've been searching for a solution using google and seen some suggestions to return the vector from the function or use pointers. I'm struggling to implement either of those ideas!Code:void Class :: Function1 (vector<double> v) { //Fill Vector } void Class :: Function2 (vector <double> v) { //Multiplies vector elements with a constant }
Any help appreciated,
Thanks a lot!