Cruz
19th January 2009, 10:38
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()
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()
What would happen if I call delete[] ql?
Thanks
Cruz
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()
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()
What would happen if I call delete[] ql?
Thanks
Cruz