I guess we could add some output to your container benchmark app that explains what your QList<T> will actually do and not do.
martin ________________________________________ From: [email protected] <[email protected]> on behalf of Marc Mutz <[email protected]> Sent: Monday, July 27, 2015 11:16 AM To: [email protected] Subject: Re: [Development] HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO On Monday 27 July 2015 00:27:18 Kevin Kofler wrote: > It doesn't switch the stuff it actually guarantees: That sentence is perfectly correct. But here's the catch: The docs guarantee _a certain implementation_, incl. the switching. The problem is that the conditions under which the switch occurs are quite hard for non-experts to check. This is the beauty of the STL: without mentioning the actual implementation anywhere, its containers have such tailor-made guarantees that effectively only one implementation possibility is left (they even rule out CoW without mentioning it!). But since the STL doesn't specify any implementation, if research finds a data structure that meets those guarantees, the new structure automatically becomes permissible. This is what made std::make_shared's optimisation possible, e.g. Qt containers are not like that. QList docs say exactly how it's implemented, but not exactly what it guarantees. Thus, coming to depend on details of the implementation is a perfectly reasonable thing to do for a developer. It's documented, after all, if only indirectly. Quite some code in QtBase alone already depends on the de-facto guarantee of stable references, among them, just off the top of my head: - QDataWidgetMapper - QToolBox - one of the lists in QMime* - QList<QMakeLocalFileName> in qmake Thanks, Marc -- 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
