How to sort QList QDateTime *?

How to sort QList of QDateTime * objects by value of QDateTime object?

+4
source share
1 answer

You can use qSort your own comparison function:

 #include <QtAlgorithms> bool dtcomp(QDateTime* left, QDateTime *right) { return *left < *right; } QList<DateTime*> dtlist = ...; qSort(dtlist.begin(), dtlist.end(), dtcomp); 
+10
source

All Articles