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. [SOLVED] STL Map = operator not working in Creator 5.2.1. What version of C++ is this using?

[SOLVED] STL Map = operator not working in Creator 5.2.1. What version of C++ is this using?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 945 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.
  • K Offline
    K Offline
    kloveridge
    wrote on last edited by
    #1

    I am preparing some code that compiles find in Xcode, but is complaining in QT. Here's the code:

    @int TaskManager::cleanUpDeadTasks()
    {
    int deadgizmos = 0;
    for (TaskMap::iterator it=m_tasks.begin(); it!=m_tasks.end();) {
    if( !GizmoHandle::valid(it->second)) {
    it = m_tasks.erase(it);
    deadgizmos++;
    }
    else
    ++it;
    }
    return deadgizmos;
    }@

    It doesn't like the code:

    @it = m_tasks.erase(it);@

    This is a normal STL reassignment of the iterator after the previous iterator was used to remove a element from a map. The last time we saw this was on Android. But after upgrading everything to c++ 11, it went away. Any suggestions?

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

      After do some further looking, I found I can ad this to the .pro file:

      @CONFIG += c++11@

      1 Reply Last reply
      0
      • JohanSoloJ Offline
        JohanSoloJ Offline
        JohanSolo
        wrote on last edited by JohanSolo
        #3

        [quote author="kloveridge" date="1396579537"]This is a normal STL reassignment of the iterator after the previous iterator was used to remove a element from a map. The last time we saw this was on Android. But after upgrading everything to c++ 11, it went away. Any suggestions?
        [/quote]

        For completness, in C++ (no C++11) the map::erase doesn't not return anything: documentation

        I've also been tricked a couple of times by this.

        `They did not know it was impossible, so they did it.'
        -- Mark Twain

        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