Hi all I'm having compilation error when I'm using vector iterator in a function itself.
i've tried executing the example from http://ideone.com/tTDYU5 and it works perfectly fine. However when I try to put it in a function things gets ugly why is this so?
vector <PointTwoD> topfive;
void MissionPlan::topfives()
{
topfive.assign( point1.begin(), point1.end() );
sort(topfive.begin(), topfive.end(), sortByCiv);
}
void MissionPlan::DisplayTopFiveResult()
{
missionplan.topfives();
vector<PointTwoD>::iterator it = topfive.begin();
for (int i = 0; i < 5 && it != topfive.end(); i++) {
cout << "X axis: " << pointtwoD.xcord << " " << "Y axis: " << pointtwoD.ycord << " " << "CIV Index: " << pointtwoD.civIndex << *it;
++it;
}
}