1 清空vector中的所有元素并释放内存:
1 vector<int*> xx; 2 for(int it=0;it!=xx.size();++it) 3 { 4 delete xx[it]; 5 } 6 xx.clear();
1 清空vector中的所有元素并释放内存:
1 vector<int*> xx; 2 for(int it=0;it!=xx.size();++it) 3 { 4 delete xx[it]; 5 } 6 xx.clear();
转载于:https://www.cnblogs.com/jinzhipeng/p/6825585.html