• 5910阅读
  • 3回复

[讨论]qlist问题 [复制链接]

上一主题 下一主题
离线jery16
 

只看楼主 倒序阅读 楼主  发表于: 2011-01-04
qlist<int> list;
list是分配到栈上的吧,如果list的内容过多会导致栈溢出吧?
离线biggerdog
只看该作者 1楼 发表于: 2011-01-04
Qt provides the following sequential containers: QList, QLinkedList, QVector, QStack, and QQueue. For most applications, QList is the best type to use. Although it is implemented as an array-list, it provides very fast prepends and appends. If you really need a linked-list, use QLinkedList; if you want your items to occupy consecutive memory locations, use QVector. QStack and QQueue are convenience classes that provide LIFO and FIFO semantics.

也就是说 堆栈和队列分别是QStack和QQueue,而QList是作为数组列表的,应该不会溢出吧?
离线jery16

只看该作者 2楼 发表于: 2011-01-04
为啥数组列表就不会溢出呢?
离线biggerdog
只看该作者 3楼 发表于: 2011-01-04
我想是不是因为QList没有分配大小一说,它会动态分配数组内存 当然啦 你说的QList最多能存储多少 我也没有试验过 反正我没有用到溢出的时候
快速回复
限100 字节
 
上一个 下一个