QMultiMap strange behavior



  • Please, look at this code:

    @
    QMultiMap<QString, int> map;
    map.insert("a", 0);
    map.insert("a", 1);

    QList<int> values = map.values("a");
    //qDebug() << values.size();
    for (int i = 0; i < values.size(); i++) qDebug() << values.at(i);
    

    @

    With qDebug() << values.size() commented it prints out only the first value of the key "a".
    If I enable the qDebug() of the values.size() it prints out both values!

    Qt5.3 under linux arm (RPi).
    Any idea?


  • Lifetime Qt Champion

    Hi,

    On OS X with 5.4, it works as expected



  • I don't see why it would not work, but if it doesn't, it seems to me the problem would be in QList, not in QMultiMap right? However, due to the very core nature of QList and the fact that it is used everywhere, I find it extremely unlikely that it would faulty in such basic behaviour. More likely something a clean complile would solve, I think.


Log in to reply
 

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