But reallocating on erase still falls under the problem that it invalidates everything, including the part before the erased range.
Indeed. This is why I mentioned it in the first place. This can be "disabled" by calling reserve(). Anyhow, I am not against any of the options: have shrinking optimization or not in erase(). It would just be good to know why it was needed (or thought of) initially. -- Best Regards, Andrei ________________________________ From: Development <[email protected]> on behalf of Giuseppe D'Angelo via Development <[email protected]> Sent: Thursday, September 10, 2020 12:29 PM To: [email protected] <[email protected]> Subject: Re: [Development] Important recent changes in QList/QString/QByteArray Il 10/09/20 08:48, Andrei Golubev ha scritto: > > That's the dilemma that Andrei was talking about. Either solution is > valid and > both have a way for you to tell QList to do what you want. > > Oh, but it's not a question of "if". It is already done in latest dev > this way, the shrinking erase, I mean (not sure who was an author of the > original change). But reallocating on erase still falls under the problem that it invalidates everything, including the part before the erased range. -- 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
_______________________________________________ Development mailing list [email protected] https://lists.qt-project.org/listinfo/development
