The "flag" is basically "a call to reserve was made"? How do I clear the flag?
shrink_to_fit()/squeeze() do this along the way.

--
Best Regards,
Andrei
________________________________
From: Ville Voutilainen <ville.voutilai...@gmail.com>
Sent: Thursday, September 10, 2020 4:38 PM
To: Andrei Golubev <andrei.golu...@qt.io>
Cc: development@qt-project.org <development@qt-project.org>
Subject: Re: [Development] Important recent changes in QList/QString/QByteArray

On Thu, 10 Sep 2020 at 16:04, Andrei Golubev <andrei.golu...@qt.io> wrote:
>
> Should I expect to do a reserve call with a *smaller* value than my
> current size is before removing elements from
> a container, in order to set a "target size"? For any standard
> container, such a reserve is a complete noop because
> it can't be responded to by shrinking a capacity lower than the size,
> but with QList it apparently records a preferred size?
>
> No. If the value passed to reserve is smaller than capacity, we do not 
> shrink*.
> For any passed value, we set a specific flag that the capacity is reserved. 
> There is no notion of "target size" and "target capacity" is out of scope of 
> the container (this is something that the user knows about).
> Instead, having the flag in place, we can decide whether allocation should 
> take place or not. When allocation is not obligatory and the capacity 
> reservation flag is set, we do not reallocate but instead do "something 
> else": in case of erase - just remove elements, in case of prepend - move 
> data around (if necessary).
> The flag is a mere part of QCC's state.

The "flag" is basically "a call to reserve was made"? How do I clear the flag?
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to