Hi!
My C++ skills are still faint. How do I delete a QList the right way?
QList<T> ql = new QList<T>;
ql.append(something);
ql.clear()
QList<T> ql = new QList<T>;
ql.append(something);
ql.clear()
To copy to clipboard, switch view to plain text mode
Does clear() call the destructors on the objects in the list? (If they are objects that is, and not pointers or primitives.)
Or do I have to it like this?
QList<T> ql = new QList<T>;
ql.append(something);
for (int i = 0; i < ql.size(); i++)
delete ql.at(i);
ql.clear()
QList<T> ql = new QList<T>;
ql.append(something);
for (int i = 0; i < ql.size(); i++)
delete ql.at(i);
ql.clear()
To copy to clipboard, switch view to plain text mode
What would happen if I call delete[] ql?
Thanks
Cruz
Bookmarks