Original Post
I am assigning a simple list of vector Objects as below
for (int j = 0; j < 3; j++)
{
CAirClass myClass;
myClass.GetData(j+1); //Offset as 1st file is .1 not .0
myClass.DumpData();
v->push_back(myClass);
printf ("Loaded in Data File %i\n",j+1);
}
And trying to read them back via an iterator
for (*i = v->begin(); *i != v->end(); ++i)
{
CAirClass &air = **i;
air.DumpData();
}
the 2 segments of code are both in the same function. When the second segment runs, it dumps out the data for the first object OK, then fails (exiting due to SIGSEV in DJGPP).
I thought that this was due to losing data in the vector, so I tried the following;
CAirClass &air1 = v->front(); air1.DumpData(); CAirClass &air3 = (v->back()); air3.DumpData();I then get all the data from my first and last objects, so my data is present. Can anyone tell me why the iterator method fails ? My AirClass has a copy constructor and an operator= defined. TIA, Bp