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

Andrei Golubev andrei.golubev at qt.io
Wed Sep 9 15:38:01 CEST 2020


I don't understand what this means. Am I supposed to reserve a
container to its current size before erasing elements
from it, if I don't want the erase to shrink it?
Yes.

--
Best Regards,
Andrei
________________________________
From: Ville Voutilainen <ville.voutilainen at gmail.com>
Sent: Wednesday, September 9, 2020 4:20 PM
To: Andrei Golubev <andrei.golubev at qt.io>
Cc: development at qt-project.org <development at qt-project.org>
Subject: Re: [Development] Important recent changes in QList/QString/QByteArray

On Wed, 9 Sep 2020 at 11:58, Andrei Golubev <andrei.golubev at qt.io> wrote:
> On the other hand, "please do not free memory, I still need it" use-case is also justified. However, chances are that when you really need a certain memory to be allocated/preserved, there is a call to QList::reserve() prior to insertions/deletions. And since we do not shrink in case of reserved memory, users should be safe in this case, in general.

I don't understand what this means. Am I supposed to reserve a
container to its current size before erasing elements
from it, if I don't want the erase to shrink it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200909/106159ee/attachment.html>


More information about the Development mailing list