Results 1 to 3 of 3

Thread: QVector, QLinkedList

  1. #1
    Join Date
    Jul 2010
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QVector, QLinkedList

    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

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QVector, QLinkedList

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QVector, QLinkedList

    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).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Circular QLinkedList
    By dyngoman in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2010, 08:57
  2. Sorting a qLinkedList
    By pwaldron in forum Qt Programming
    Replies: 3
    Last Post: 19th January 2010, 21:59
  3. QList or QLinkedList
    By eleanor in forum Newbie
    Replies: 6
    Last Post: 9th November 2007, 09:40
  4. QLinkedList iterator
    By ^NyAw^ in forum Qt Programming
    Replies: 8
    Last Post: 18th October 2007, 16:15
  5. QLinkedList and iterators
    By eu.x in forum Newbie
    Replies: 1
    Last Post: 19th April 2007, 19:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.