QMap max size

  • Hello,
    I am trying to fill a QMap with words and their lemmatized versions. This is the code:

            QString line = inStream.readLine();
            QStringList splitLine = line.split('\t');
            //lemmaList is of type QMap
            lemmaList.insert(splitLine.at(0), splitLine.at(1));
            qDebug() << lemmaList.size();

    Everything goes well until the 332085th element, where I suddenly get a ASSERT failure in QList<T>::at: "index out of range", file C:\Qt\5.11.0\mingw53_32\include/QtCore/qlist.h, line 541 error. Is that due to a size limit of QMap? If so, is there away to raise it?

  • Lifetime Qt Champion

    Since its about QList (ASSERT failure ) and not QMap
    i think you have a format error and you acces splitline with invalid index
    if format error then
    there might be no index for splitLine.at(1)

    if (splitLine.size() > 1 )
    lemmaList.insert(splitLine.at(0), splitLine.at(1));
    qDebug () << "format error";

  • Yep, the issue was indeed in the file. Thanks!

Log in to reply

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