I have a small problem: I am using an iterator to go through a list, but I can't seem to access previous positions using just it.
std::list<int>::iterator i;
for(i=mylist.begin();i!=mylist.end();i++)
{
if(*i<0) fprintf(fout,"%d",*(i-1));//here i want to access the (i-1)th element
}