怎样反向遍历QList(C++风格)
RT
如果是用STL,我会这样做:
#include <iostream>
#include <list>
using namespace std;
int main()
{
list<int> mylist;
for(int i=0; i<10; i++)
mylist.push_back(i);
list<int>::reverse_iterator riter = mylist.rbegin();
for(; riter!=mylist.rend(); ++riter)
cout << *riter << endl;
return 0;
}