Thank you... Understood!
See, i use:
for (int i = 0; i < n; ++i)
list.removeFirst();
it is will be the best variant?
Thank you... Understood!
See, i use:
for (int i = 0; i < n; ++i)
list.removeFirst();
it is will be the best variant?
So it's pretty clear.T QList::takeFirst ()
Removes the first item in the list and returns it.
This is the same as takeAt(0).
This operation is very fast (constant time), because QList preallocates extra space on both sides of its internal buffer to allow for fast growth at both ends of the list.
If you don't use the return value, removeFirst() is more efficient.
See also takeLast(), takeAt(), and removeFirst().
Regards
pakulo (2nd June 2007)
Thanks a lot!
It preallocates extra space? And here I thought QList was a linked list. Such a list wouldn't need preallocation to grow at both ends. But now I see. There is also a QLinkedList class. But since there is also a QVector class (which would use a dynamic array, I guess), how is QList implemented?
"The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry
Bookmarks