Results 1 to 5 of 5

Thread: Vector allocation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    9
    Thanked 29 Times in 29 Posts

    Default Re: Vector allocation

    I don't think he's talking about QVector. Just vector.

    And I also think a linked list would be better suited for the job.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

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

    Default Re: Vector allocation

    Quote Originally Posted by Michiel View Post
    I don't think he's talking about QVector. Just vector.
    reserve() works in a simmilar way for all std::vector-like implementations (including QVector).

    And I also think a linked list would be better suited for the job.
    It depends. The drawback of using a linked list is that accessing items in a non-sequential order is slower. If you know the size of the data array you need upfront, using vector or an arraylist (like QList) should be better.

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.