Il 10/09/20 04:31, Thiago Macieira ha scritto:
This is another against automatic shrinking; it may invalidate
everything rather than just the erased area. I don't understand the
"detach" part, is it about holding references across a detach, so they
refer to the original container, not the detached one? That's not
different from we always had, isn't it?
It means that if you try to erase from a container that is currently shared,
it will detach. When it does, the detached container's size will be evaluated
in terms of the size of the container, not the capacity the shared container
had.


Why isn't the capacity carried across?

QVector<Foo> v;
v.reserve(100);
v.push_back(~~~); // fill it up

// someone takes a copy
auto v2 = v;

// erase into the original
v.erase(~~~);
// now v's capacity is no longer reserved to be >= 100?

My 2 c,

--
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

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

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to