Hello,
Could anyone please tell me the difference between QVector and QLinkedList.
And when are they used?
Because they look quite similar.
Thank you
Aashish
Hello,
Could anyone please tell me the difference between QVector and QLinkedList.
And when are they used?
Because they look quite similar.
Thank you
Aashish
QVector<T> is a generic container classes. It stores its items in adjacent memory locations and provides fast index-based access.
QLinkedList<T> is another generic container classes. It stores a list of values and provides iterator-based access as well as constant time insertions and removals.
Those two classes are completely different. QVector is index based and assures items occupy a contignous area of memory. QLinkedList is a sequential container. In most cases you should use neither one nor the other but rather QList. QLinkedList is only interesting for very large lists which you only access sequantially (i.e. when you are interested only in neighbourhood of the current item).
Bookmarks