Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Solved] qLowerBound and qLess do not work together?

    General and Desktop
    1
    1
    580
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Asperamanca last edited by

      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.

      EDIT:
      Stupid syntax mistake. The error message threw me off.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post