[Development] Important recent changes in QList/QString/QByteArray
Thiago Macieira
thiago.macieira at intel.com
Tue Sep 1 19:33:19 CEST 2020
On Tuesday, 1 September 2020 08:53:36 PDT Giuseppe D'Angelo via Development
wrote:
> So, now, formally, std::sort(v.begin(), v.end()) risks undefined
> behavior? E.g. begin() returns the begin iterator without touching
> anything, but end() decides to invalidate all the iterators.
We've seen this in QCborMap and QJsonObject too: trying to optimise code for
not detaching causes problems.
All non-const functions that may detach should be coded so they DO detach.
That is, after any and all non-const functions, the refcount of the container
should be 1.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel DPG Cloud Engineering
More information about the Development
mailing list