myIterator
来源:互联网 发布:北大青鸟软件培训 编辑:程序博客网 时间:2024/05/29 18:56
#include <QtCore/QCoreApplication>#include <QList>#include <QDebug>int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); QList<QString> list; list << "A" << "B" <<"C" << "D"; QList<QString>::iterator i; qDebug() << "the forward is :"; for (i=list.begin(); i!=list.end();++i){ *i=(*i).toLower(); qDebug() << *i; } qDebug() << "the backward is :"; while(i!=list.begin()){ --i; qDebug() << *i; } QList<QString>::const_iterator j; qDebug() << "the forward is:"; for(j=list.constBegin(); j!=list.constEnd(); ++j) qDebug() << *j; return a.exec();}
0 0