PDA

View Full Version : QList::clear() and QList::reserve()



Momergil
13th June 2014, 14:33
Hello!

Let's say I know exactly how many items I'll have on my QList; so I call QList::reserve(numItems) to set it at the start of my code's working.

In a given moment, I want to release all data inserted on my List. So I call QList::clear().

After that, since QList::clear() clears the internal buffer, do I need to call QList::reserve(numItems) again before starting over again? Or the first called QList::reserve() maintains its functionality even after the call to QList::clear()?

Thanks,

Momergil