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 _______________________________________________ Development mailing list [email protected] https://lists.qt-project.org/listinfo/development
