vectors vs. lists

Adriaan de Groot adridg at cs.kun.nl
Thu Feb 19 12:02:09 GMT 2004


On Thursday 19 February 2004 12:49, Werner Trobin wrote:
> On Thursday 19 February 2004 10:46, Marc Mutz wrote:
> > It's really funny how STL-trained people default to std::vector<> in all
> > their code, and you see std::list<> only very rarely, but you see
> > QValueList used as a default in KDE/Qt, and in ways that involve
> > indexing (O(n)! vs. O(1) in QVV). This loop, btw,:
>
> While I agree with all of your points this O(n^2) statement is not true.
> Please check at() and especially locate() in QGList.

The Qt 3.2 docs say "uses a linear search and may be slow" - although I seem 
to remember that at some point the list had a "current item" and that it used 
linear search from the start, the end, or the current item depending on what 
was closest.

-- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot at kde.org>
                     Would you like a freem?




More information about the kde-core-devel mailing list