QtAlgorithms

qSort()

qCopy()

qFill()

#include <QCoreApplication>
#include<QDebug>
#include<QVector>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QVector<QString>Vect(5);
    qFill(Vect.begin()+1,Vect.end()-2,"Hello wordl");
    foreach(QString itm,Vect)
    {
        qDebug() << itm;
    }

    return a.exec();
}

qFind()

#include <QCoreApplication>
#include<QDebug>
#include<QVector>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QList<int>List;
    List << 1<<5<<15<<23;
    QList<int>::const_iterator iter = qFind(List.begin(),List.end(),55);

    if(iter != List.end())
    {
        qDebug()<<"Found: "<<*iter;

    }
    else
    {
        qDebug() <<"No";
    }
    return a.exec();
}

  

posted @ 2016-12-19 10:59  mCat  Views(414)  Comments(0)    收藏  举报