Maybe it's just me, but I'm still not understanding your explanation, and I don't think you are answering my question:
I have a struct C which is bigger than a pointer. I declare QList<C>. Does your explanation mean that sometimes (most of the time, in fact), the list will become an array of C* instead of an array of C? martin ________________________________________ From: [email protected] <[email protected]> on behalf of Marc Mutz <[email protected]> Sent: Friday, July 10, 2015 1:34 PM To: [email protected] Subject: Re: [Development] HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO On Friday 10 July 2015 13:29:30 Marc Mutz wrote: > On Friday 10 July 2015 12:18:04 Smith Martin wrote: > > ...it will create each list entry as a QList<ParsedParameter*> even > > though I told it not to do that? > > Yes. But you told it to do that. You used a _list_. Ok, I take the bait: QList is primarily a list, not an array (thus the name). That means that, by default, references to elements in the list are never invalidated until the element is removed again. The problem started when someone optimised QList to contain the elements in an array, but only for *some* types. So, depending on the type and the QTypeInfo for that flag, QList is either like a std::list or like a std::vector (QLinkedList / QVector in Qt speak). And it takes great mental discipline to use it in the proper way, and the resulting code will be highly fragile and/or extremely inefficient. 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
