I want to pass a vector to a method where values are set. Something like this
void myClass::func1()
{
vector<double> density;
density.assign(2,0);
func2(density);
(use density)
}
void myClass::func2(vector<double> density)
{
density[0]=this;
density[1]=that;
}
------
Now; when plotting the values of density in func2, it has the correct values, but in func1 it is just zero. Is there any way of sending the vector into a function in the same way as one would do with an ordinary array?
Best
Carlis
void myClass::func1()
{
vector<double> density;
density.assign(2,0);
func2(density);
(use density)
}
void myClass::func2(vector<double> density)
{
density[0]=this;
density[1]=that;
}
------
Now; when plotting the values of density in func2, it has the correct values, but in func1 it is just zero. Is there any way of sending the vector into a function in the same way as one would do with an ordinary array?
Best
Carlis