QMap max size
Solved
General and Desktop
-
Hello,
I am trying to fill a QMap with words and their lemmatized versions. This is the code:while(!inStream.atEnd()) { 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? -
Hi
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)try
if (splitLine.size() > 1 )
lemmaList.insert(splitLine.at(0), splitLine.at(1));
else
qDebug () << "format error"; -
Yep, the issue was indeed in the file. Thanks!