[Development] Container benchmark was HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO
Thiago Macieira
thiago.macieira at intel.com
Mon Jul 20 21:31:13 CEST 2015
On Monday 20 July 2015 22:01:01 Marc Mutz wrote:
> 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.
Agreed, but we may need a better name. "Array list" is kind of a redundant. We
could bring back a Qt3 name like QPtrList, though "QPointerList" might confuse
with "a list of QPointer". Anyway, name bikeshedding for the future...
> 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).
Yup, makes sense too.
Note that template aliases have a weird and slightly unexpected side-effect: a
specialisation of one does not imply specialisation of the other. And that, of
course, is not properly implemented in compilers of today.
We'd need to properly investigate things like QVector<QString> and
QList<QString> and how to deal with their special methods.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list