You do not want remove, but list::erase. Here is your code with tags and a little more cleaned up:
cout << "Contents: ";
list<FileInfo*>::iterator p = futurelist.begin();
while(p != futurelist.end()) {
cout << (*p)->submissiontime << " ";
cout << (*p)->length << " ";
cout << (*p)->finishtime << " ";
const int length = (*p)->length;
if(length < averageBW){
++Noactive;
}else{
++Nodelayed;
}
p = future.erase(p) //no need to increment p, since .erase returns the next element
}
cout << "\n\n";
But if that doesn't solve your problem, please be more specific.
EDIT: the reason why it james is because after you call .remove(*p), the iterator *p is invalid.
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608