Re: [Development] QVector: clear while keeping capacity

2014-11-05 Thread Smith Martin
Good one! From: Pocheptsov Timur Sent: Wednesday, November 5, 2014 4:30 PM To: Smith Martin; Milian Wolff; Allan Sandfeld Jensen Cc: development@qt-project.org Subject: Re: [Development] QVector: clear while keeping capacity v.erase(v.begin(), v.end

Re: [Development] QVector: clear while keeping capacity

2014-11-05 Thread Pocheptsov Timur
: Re: [Development] QVector: clear while keeping capacity I think there should be a way to empty the vector without losing the memory. I would have said clear() should do that, but clear() says it releases the memory. martin From: development-bounces

Re: [Development] QVector: clear while keeping capacity

2014-11-05 Thread Smith Martin
Milian Wolff Sent: Wednesday, November 5, 2014 3:21 PM To: Allan Sandfeld Jensen Cc: development@qt-project.org Subject: Re: [Development] QVector: clear while keeping capacity On Wednesday 05 November 2014 14:33:00 Allan Sandfeld Jensen wrote: > On Wednesday 05 November 2014, Milian Wolff wr

Re: [Development] QVector: clear while keeping capacity

2014-11-05 Thread Milian Wolff
On Wednesday 05 November 2014 14:33:00 Allan Sandfeld Jensen wrote: > On Wednesday 05 November 2014, Milian Wolff wrote: > > Hello all, > > > > could it be that QVector changed its behavior in Qt5? I just noticed that > > resize(0) does deallocate memory, which is highly unexpected from my side. >

Re: [Development] QVector: clear while keeping capacity

2014-11-05 Thread Allan Sandfeld Jensen
On Wednesday 05 November 2014, Milian Wolff wrote: > Hello all, > > could it be that QVector changed its behavior in Qt5? I just noticed that > resize(0) does deallocate memory, which is highly unexpected from my side. > See e.g. this old thread where it was said to use resize(0) to clear a > vect

[Development] QVector: clear while keeping capacity

2014-11-05 Thread Milian Wolff
Hello all, could it be that QVector changed its behavior in Qt5? I just noticed that resize(0) does deallocate memory, which is highly unexpected from my side. See e.g. this old thread where it was said to use resize(0) to clear a vector while keeping its capacity: http://comments.gmane.org/gm