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 max size
Forum Updated to NodeBB v4.3 + New Features

QMap max size

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

    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?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      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";

      1 Reply Last reply
      3
      • E Offline
        E Offline
        El3ctroGh0st
        wrote on last edited by
        #3

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

        1 Reply Last reply
        1

        • Login

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