I have a List of object pointers, and I'm trying to delete an element with an iterator pointer and I keep getting build errors as I'm not sure what the proper way to go about this is. Here is some of the code in question. Also, here is my error in a pastebin.
class PlaneManager{ private: list * planes = new list; list::iterator * iter = new list::iterator; public: void DeletePlane(const string& tailNumber);
Here is the function in question that throws errors.
void PlaneManager::DeletePlane(const string& tailNumber){
if(PlaneExists(tailNumber)){
for (iter = planes->begin(); iter != planes->end();++iter){
if(iter.GetTailNumber() == tailNumber)
planes->erase(iter);
}
}else
cout << "Couldn\'t find that plane." << endl;
}
Thanks for any insight you can provide, as I'm still a little lost with pointers.