Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMap doesn't have equal_range?
Forum Updated to NodeBB v4.3 + New Features

QMap doesn't have equal_range?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.6k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    panosk
    wrote on last edited by
    #1

    Hello all,

    According to the docs, "QMap":http://qt-project.org/doc/qt-5/qmap.html#equal_range includes the equal_range algorithm, but actually it doesn't (Qt 5.2). Is it deliberately left out? In that case, an update to the doc is needed. For the time being I'm mixing QMap and std::multimap to get the functionality I want, but I would rather avoid it.

    Anyway, where/who should I ask to have it included?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You need to check on "JIRA":https://bugreports.qt-project.org/secure/Dashboard.jspa if it has been reported already otherwise you need to report it.
      The doc-link you are providing points to Qt 5.2 documentation. So there is a problem.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koval
        wrote on last edited by
        #3

        This method exists in Qt 5.2.1 but according to git it was there for ages.
        qmap.h, line 861 contains this:
        @template <class Key, class T>
        QPair<typename QMap<Key, T>::iterator, typename QMap<Key, T>::iterator> QMap<Key, T>::equal_range(const Key &akey)
        {
        detach();
        Node *firstNode, *lastNode;
        d->nodeRange(akey, &firstNode, &lastNode);
        return QPair<iterator, iterator>(iterator(firstNode), iterator(lastNode));
        }
        @

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          [quote author="koval" date="1393070848"]This method exists in Qt 5.2.1 but according to git it was there for ages.
          qmap.h, line 861 contains this:
          @template <class Key, class T>
          QPair<typename QMap<Key, T>::iterator, typename QMap<Key, T>::iterator> QMap<Key, T>::equal_range(const Key &akey)
          {
          detach();
          Node *firstNode, *lastNode;
          d->nodeRange(akey, &firstNode, &lastNode);
          return QPair<iterator, iterator>(iterator(firstNode), iterator(lastNode));
          }
          @[/quote]

          Thanks for checking

          [quote author="panosk" date="1393068764"]Hello all,

          According to the docs, "QMap":http://qt-project.org/doc/qt-5/qmap.html#equal_range includes the equal_range algorithm, but actually it doesn't (Qt 5.2). Is it deliberately left out? In that case, an update to the doc is needed. For the time being I'm mixing QMap and std::multimap to get the functionality I want, but I would rather avoid it.

          Anyway, where/who should I ask to have it included?[/quote]

          So, it should be problem with your installation or your code.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • P Offline
            P Offline
            panosk
            wrote on last edited by
            #5

            Thank you both.

            Indeed, equal_range works if I type it manually, but Qt Creator 3 doesn't offer it or recognize it as a token for some reason, so it may be a bug with Qt Creator. Another issue with Qt Creator is that it doesn't offer the iterators for nested containers that don't have a space between the closing >> (no longer necessary in C++11).

            Can sb else confirm these issues too so I can file relative bugs? I've took a look in the bug tracker and couldn't find anything related.

            Thanks.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved