Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-129348

comparing iterator with const_iterator breaks the C++ standard

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • None
    • 6.7.2
    • None

    Description

      In containers like QMap, comparing iterator with const_iterator does not always return the expected output.

      A quick search through the bug reports shows that this issue has been dismissed in the past as "it's wrong to mix iterator and const_iterator": QTBUG-50314 QTBUG-10025 QTBUG-69182

      However it is in the C++ standard, since C++14, that you can compare iterator and const_iterator.

      [container.requirements.general] paragraph 7:

      In the expressions
        i == j
        i != j
        i < j
        i <= j
        i >= j
        i > j
        i <=> j
        i - j
      where i and j denote objects of a container’s iterator type, either or both may be replaced by an object of the container’s const_iterator type referring to the same element with no change in semantics

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            aleasto Alessandro Astone
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes