[Solved] qLowerBound and qLess do not work together?

  • The following code does not compile with Qt 4.8

    @ QList<int> list;
    list << 1 << 4 << 7 << 8;
    QList<int>::Iterator qLowerBound(list.begin(), list.end(), 4, qLess<int>());@

    Error message is

    bq. tscd_recordingtrackdataaccess.cpp: In member function 'HIPASE::CTdev_CurveRecordingPoint HIPASE::CTscd_RecordingTrackDataAccess::getPointForTimeOffset(int64) const':
    tscd_recordingtrackdataaccess.cpp:64: error: no matching function for call to 'QList<int>::iterator::iterator(QList<int>::iterator, QList<int>::iterator, int, qLess<int>)'
    c:\Qt482_MinGW\include/QtCore/../../src/corelib/tools/qlist.h:173: note: candidates are: QList<T>::iterator::iterator(const QList<T>::iterator&) [with T = int]
    c:\Qt482_MinGW\include/QtCore/../../src/corelib/tools/qlist.h:172: note: QList<T>::iterator::iterator(QList<T>::Node*) [with T = int]
    c:\Qt482_MinGW\include/QtCore/../../src/corelib/tools/qlist.h:171: note: QList<T>::iterator::iterator() [with T = int]

    I know that I could use the default operator< of int in this case, but I want to expand to a custom lessThan later on, so tested the "out of the box" stuff first to understand it.

    Stupid syntax mistake. The error message threw me off.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.