[Development] Container benchmark was HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO

Marc Mutz marc.mutz at kdab.com
Mon Jul 20 22:01:01 CEST 2015


On Monday 20 July 2015 16:53:04 Knoll Lars wrote:
> Most likely, we should change QList in Qt 6 to simply share it’s
> implementation with QVector and make them both compatible, but we
> unfortunately can’t do this right now.

I'd rename it QArrayList and have it always operate in new'ed-up-items mode. 
That container is not available from the STL (though vector<unique_ptr> comes 
close), so I'm ok with keeping it. But then it must _always_ new up items, 
even bools, otherwise you again can't rely on reference stability.

If you want a vector, use a vector. Don't call a vector a list. Yes, that's 
going to be massively SiC, but by Qt 6, we can hopefully rely on template 
aliases to mitigate that problem (so a backwards-compatibility QList could be 
an alias for vector for types for which it basically is now (modulo padding), 
and QArrayList otherwise).

My .02€

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list