Qt-interest Archive, March 2002
Collection class
Message 1 in thread
Hi everyone,
What is the most appropriate collection class to store a series of values
(not pointers)? Also, is it safe for a function to return a result which
is typed as one of the collection class, ie., QVector<MyClass> function
(...)?
Thanks,
--
[ signature omitted ]
Message 2 in thread
I guess it would depend on how you wish to access the elements in the
collection. If you haven't already looked the different options are
described at:
http://doc.trolltech.com/3.0/collection.html#collection-classes
My guess is you would be interested in one of:
QValueList,
QValueVector,
QValueStack, or
QMap
As for returning a collection class I don't see why not. If its a large
collection though you might consider using a pointer as otherwise the whole
container has to be copied when the function ends.
Craig
> ----------
> From: Eddy Young[SMTP:jeyoung@priscimon.com]
> Reply To: jeyoung@priscimon.com
> Sent: Thursday, March 21, 2002 12:13 PM
> To: Qt Interest
> Subject: Collection class
>
> Hi everyone,
>
> What is the most appropriate collection class to store a series of values
> (not pointers)? Also, is it safe for a function to return a result which
> is typed as one of the collection class, ie., QVector<MyClass> function
> (...)?
>
> Thanks,
> --
> Eddy Young - jeyoung@priscimon.com - Tel: +44 (0)20 8337 6020
>
> --
> List archive and information: http://qt-interest.trolltech.com
>