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

Marc Mutz marc.mutz at kdab.com
Mon Jul 13 17:09:49 CEST 2015


On Monday 13 July 2015 14:42:38 Milian Wolff wrote:
> and `strip` the binaries afterwards. So it's still ~2KB worse off - any
> chance  for using `extern templates` or similar to reduce this code bloat?

Might work for QList<QByteArray>, but for most types, no. Explicitly 
instantiating QList also instantiates (parts of) QVector, QSet, and std::list, 
by way of toSet/toVector/toStdList members (this is one of the reasons why you 
shouldn't add as members what you can add as non-member) which adds having a 
default ctor and a qHash() overload to the requirements on the type, on top of 
what QList requires.

Not all types satisfy that, e.g. QPointF.

-- 
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