I want to fill a vector named firstApp with some informations(id,position(x,y),frameNumber).So I make a condition to avoid filling the vector with existing informations.
for (int idxCurrent = 0; idxCurrent < nOfPedcurrFrame ; idxCurrent++)
{
if(nOfPedprevFrame == 0)
{
CurrentId=frames[frameNumber].GetPedest()[idxCurrent].GetID();
FA=FirstAppear(frames,CurrentId,idxCurrent);
FirstPosition=frames[FA].GetPedest()[idxCurrent].GetPosition();
f.SetFrameNumber(FA);
f.SetFirstPosition(FirstPosition);
f.SetFId(CurrentId);
if(firstApp.size() !=0 ){
p=std::find(firstApp.begin(),firstApp.end(),f);
std::cout << *p<< endl;
if(p == firstApp.end()){
firstApp.push_back(f);
}
}
else
{
firstApp.push_back(f);
}
f.~FirstAppearance();
}
}
I use std::find to search if f exists in my vector to fill it on.But when I compile my program I got that p had such value the first value of f along the life of my program.Can any one tell me why std::find didn't update the value of f with the new value?? the output of *p is:
1 263 138 0
1 263 138 0
1 263 138 0
1 263 138 0
1 263 138 0
Aucun commentaire:
Enregistrer un commentaire