[SOLVED] QVector<*Object> memory
-
I am wondering if using .clear() on a QVector of pointers will delete the object associated with the pointer inside the Vector. Or do you have to to this yourself?
Qt Doc not clear to me :* Removes all the elements from the vector and releases the memory used by the vector.*
http://doc.qt.io/qt-5/qvector.html#clearThanks
-
@maximus said:
I am wondering if using .clear() on a QVector of pointers will delete the object associated with the pointer inside the Vector. Or do you have to to this yourself?
You have to do it yourself.
qDeleteAll() is useful for this: http://doc.qt.io/qt-5/qtalgorithms.html#qDeleteAll
Qt Doc not clear to me :* Removes all the elements from the vector and releases the memory used by the vector.*
http://doc.qt.io/qt-5/qvector.html#clearThat means: Release the memory used to store the pointers.