Re: [Development] Question about the QDataBuffer from src/gui/painting

2015-10-26 Thread Marc Mutz
On Monday 26 October 2015 09:41:00 Gunnar Sletta wrote: > Also, given the purpose of this class, then using QDataBuffer as an > on-the-stack member in a function (like in mergePoints()) will pretty much > always be wrong. There is no point in using a pool when it is discarded > after a single use,

Re: [Development] Question about the QDataBuffer from src/gui/painting

2015-10-26 Thread Gunnar Sletta
> On 26 Oct 2015, at 10:12, Marc Mutz wrote: > > On Monday 26 October 2015 08:20:38 Gunnar Sletta wrote: >> The purpose of QDataBuffer is to provide a managed pool of memory that can >> grow, but does not shrink unless shrunk explicitly. QVector is unusable >> for this purpose as a resize/clear/

Re: [Development] Question about the QDataBuffer from src/gui/painting

2015-10-26 Thread Gunnar Sletta
> On 26 Oct 2015, at 09:56, Marc Mutz wrote: > > On Monday 26 October 2015 08:20:38 Gunnar Sletta wrote: >> I don't know if std::vector::erase() and std::vector::clear() can guarantee >> that the data is not reallocated, even if reserve() has been specified. If >> that can be guaranteed, removin

Re: [Development] Question about the QDataBuffer from src/gui/painting

2015-10-26 Thread Marc Mutz
On Monday 26 October 2015 08:20:38 Gunnar Sletta wrote: > The purpose of QDataBuffer is to provide a managed pool of memory that can > grow, but does not shrink unless shrunk explicitly. QVector is unusable > for this purpose as a resize/clear/append would cause a lot of > reallocations for the pla

Re: [Development] Question about the QDataBuffer from src/gui/painting

2015-10-26 Thread Marc Mutz
On Monday 26 October 2015 08:20:38 Gunnar Sletta wrote: > I don't know if std::vector::erase() and std::vector::clear() can guarantee > that the data is not reallocated, even if reserve() has been specified. If > that can be guaranteed, removing the class would be fine by me. Since std::vector::er

Re: [Development] Question about the QDataBuffer from src/gui/painting

2015-10-26 Thread Gunnar Sletta
The purpose of QDataBuffer is to provide a managed pool of memory that can grow, but does not shrink unless shrunk explicitly. QVector is unusable for this purpose as a resize/clear/append would cause a lot of reallocations for the places where QDataBuffer is used. I don't know if std::vector:

[Development] Question about the QDataBuffer from src/gui/painting

2015-10-25 Thread Maks Naumov
In my small change https://codereview.qt-project.org/#/c/138795/ Marc Mutz wrote: "This class deserves to die. If you do not believe, copy an instance and you'll see." I agree with him, but it will be quite a big change because it is used in many places. https://github.com/qtproject/qtbase/se