struct T
{
int a;
int b;
};
#include <QCoreApplication>
#include <QDebug>
#include <QLinkedList>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QLinkedList<T> list;
T temp;
temp.a = 2;
temp.b = 23;
list.append(temp);
temp.a = 1;
temp.b = 5;
list.append(temp);
temp.a = 5;
temp.b = 13;
list.append(temp);
temp.a = 6;
temp.b = 6;
list.append(temp);
//
//怎样以结构体(T.a)从小到大排序?
//
foreach (T tt,list)
qDebug() << "a="
<< tt.a
<< ",b="
<< tt.b;
return a.exec();
}