Maximum size of QList.



  • Hi,

    Does somebody know how many elements can be inserted to QList? Are some relations between the size of an element and number of elements? I cannot find it in the documentation.

    Best regards,
    Grzegorz


  • Lifetime Qt Champion

    Hi,

    The maximum number of element is the maximal value of a signed int on your platform.

    Out of curiosity, why would you need that many elements ?



  • @SGaist said in Maximum size of QList.:

    The maximum number of element is the maximal value of a signed int on your platform.

    Unless you have a monster of a machine you'll probably run out of memory before you reach this limit so I'd say the real limit is the amount of RAM


  • Qt Champions 2016

    Also, if your type isn't the size of void * then you're better off using QVector or one of the STL containers.


Log in to reply
 

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