I tried the following:
cout << "\n list start \n";
list<int> l;
l.push_back(5);
l.push_back(4);
l.push_back(3);
l.push_back(2);
l.push_back(1);
list<int>::iterator i;
for (i=l.begin(); i < l.end(); i++)
{
cout << *i;
}
But I got an error on the for loop. Seems like it cannot accept the "<" operator. I tried replacing it with "!=", and it can go well already.Why is that?


Sign In
Create Account


Back to top









