[Development] Important recent changes in QList/QString/QByteArray

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Wed Sep 2 15:47:22 CEST 2020

Il 02/09/20 10:04, Ville Voutilainen ha scritto:
> Interesting. I'm curious what sort of repacking happens on erase, and why
> it wasn't done in such a way that e.g. QVector is 4 pointers instead
> of 3, so that
> the element storage wouldn't necessarily be at the beginning of the
> allocated block;
> in that approach, a pop_front would merely bump the begin, and erase
> still wouldn't
> invalidate anything before the erased position.

With this setup, one might be tempted to optimize erasure in the first 
half of the container by shifting elements towards the end (rather than 
from the end towards the beginning), as it would be cheaper. I guess 
that's what's happening here?


Giuseppe D'Angelo | giuseppe.dangelo at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200902/9823a8c6/attachment.bin>

More information about the Development mailing list