>This is not premature optimisation. It is premature because the entire structure will be removed.
________________________________________ From: [email protected] <[email protected]> on behalf of Marc Mutz <[email protected]> Sent: Friday, July 10, 2015 5:32 PM To: [email protected] Subject: Re: [Development] HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO On Friday 10 July 2015 14:48:26 Smith Martin wrote: > but I generally don'[[t try to optimize until I have a working model. This is not premature optimisation. This is avoiding premature pessimisation (google it!). QVector has exactly the same API these days as QList (except that QVector requires a default ctor and QList doesn't; if something else is missing, shout), so code using QVector is equally readable as code using QList. If that is the case, the more efficient alternative is what should naturally flow out of your fingers. And another thing: By using a QVector, not only do you avoid an additional heap allocation per element inserted, you also avoid readers of your code guessing whether you're using the QList for its list features (like the QList<Page> in QToolBoxPrivate - go, read it, it's subtle!) or just as a container. -- Marc Mutz <[email protected]> | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - The Qt Experts _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
