C++ (Qt)struct MyData { ... ~MyData( void ) {} int mType; QString * mText; ...}; void Data2Storage( QList<MyData> & src, QVector <QString *> & textStorage ){ qDeleteAll(textStorage); size_t i, limit = src.size(); textStorage.resize(limit); for (i = 0; i < limit; ++i) textStorage[i] = src[i].mText;}
C++ (Qt)template <typename T>Q_OUTOFLINE_TEMPLATE void QList<T>::clear(){ *this = QList<T>();}
for (int i = 0; i < topLevelItemCount(); ++i){ qDeleteAll(topLevelItem(i)->takeChildren());}
C++ (Qt)class CTest{public: ~CTest() { qDebug()<<"die"; }};//....CTest* _array[] = {new CTest(),new CTest(),new CTest(),new CTest(),new CTest()};qDeleteAll(_array, _array + COUNT(_array));