Problem passing vector element
I have three classes.
Trial
Robot
WriteToFile
Trial is holding a pointer to a WriteToFile object and for a Robot object.
Trial is calling Robot method to return a string and passes it to his WriteToFile.
Robot is containing a private
Code:
vector<int> samplesRobotToKalmanFilter;
I initialized it using
Code:
samplesRobotToKalmanFilter.clear();
And the return method
Code:
const vector<int>& Robot::GetSamplesReadUsingRobot() const
{
if(samplesRobotToKalmanFilter.empty())
cout<<"empty\n"; //INDEED EMPTY
return samplesRobotToKalmanFilter;
}
Inside this method I can see that samplesRobotToKalmanFilter is empty
WriteToFile has the following method
Code:
void WriteToExternalFile::WriteValuesToVector(const vector<int>& samplesvec, const vector<double>& valuesXY)
{
if(samplesvec.empty())
cout<<"empty\n"; //NOT SHOWING EMPTY
}
I call this last method from Trial instance:
Code:
writeinput->WriteValuesToVector(robot->GetSamplesReadUsingRobot() , robot->GetinputForKalmanFilter());
The problem: inside this last method samplesvec is no longer considered empty...