On 4/24/20 9:03 PM, Jason H wrote:
In fact, it is-a QList<QString>. What's the problem here with its naming?Because I can't QSringList{"me", "you"}.join() with a QList.
I didn't say that it's a typedef for QList<QString>, but is-a -- it inherits, precisely to provide that kind of convenience.
Thinking outsize of the box... It seems that all this is cause d by someone wanting to store a pointer to an item in QVector, which may be reallocted and therfore have moved.
All this => what's this?
It seem then that the only thing to do is to use a traditional QList, or return only some kind of ref which will be a stable reference to the item. QStableRef r9 = vector[9]; vector.resize() // r9 is updated during resize() and still points to that it was meant to. It's not good practice to store a ref to something that can be realloated. I don't know how you can prevent people from doing that with offering T& operator[](int i);
QList today offers exactly that. In array-of-pointers-mode it also offers stability of references.
Thanks, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development