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

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Tue Sep 1 17:53:36 CEST 2020


Thanks for the heads up!

Il 31/08/20 13:50, Andrei Golubev ha scritto:
> The invalidation existed before for cases when a container could detach 
> (due to copy-on-write) or reallocate (due to growing or squeezing). 

This sounds incorrect? Which invalidation did happen due to COW?

> Now 
> this is also true for non-detaching, non-reallocating modifying operations.

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.

Yes, I assume that in practice begin() would already invalidate, and 
end() wouldn't, so it would work, but I'm asking what's formal model 
now. Is there a way to know that the next non-const call is going to 
invalidate everything?

Side question, does anyone see a problem with begin() / data() / etc. no 
longer be noexcept O(1) operations?


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/20200901/df1ef20a/attachment.bin>

More information about the Development mailing list