[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Question about QVector and QArray
From:       Rolf Magnus <ramagnus () zvw ! de>
Date:       2001-07-22 14:18:53
[Download RAW message or body]

On Saturday, 21. July 2001 22:03, Ben Schepens wrote:

> I want to have an ordered random access list of objects
> that can have items inserted into the middle dynamically or
> appended  to the end.  How do I do that with QT's
> collection objects?
>
> I know I could resize them and shift the elements around myself
> but that seems dumb.  Is there a better way?

That's what it would need to do anyway. How would you insert an element in 
the middle without moving all the elements after it?  You can use 
QList/QValueList instead if you want to do a fast insert at any position. You 
cannot do a "random access" tough because you need to traverse the list for 
that. There always is a tradeoff whether you choose an array or a linked list.

-- 
Linux is like a Wigwam : no Gates, no Windows but an Apache inside
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic