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?

Thanks,

--
Giuseppe D'Angelo | [email protected] | 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

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to