C++——STL内存清除
1.vector元素的清除 看代码。在vector中添加若干元素,然后clear() 1 #include<iostream> 2 #include<list> 3 #include<vector> 4 #include<iterator> 5 #include< string > 6 using std::vector; 7 using std::list; 8 using std::iterator; 9 using std:: string ; 10 using std::cout; 11 using std::endl; 12 13 int main() 14 { 15 vector< string > vecStr; 16 string pStr1 = " Robb " ; 17 vecStr.push_back(pStr1); 18 string pStr2 = " Bran " ; 19 vecStr.push_back(pStr2); 20 string pStr3 = " Snow " ; 21 vecStr.push_back(pStr3); 22 string pStr4 = " Sansa " ; 23 vecStr.push_back(pStr4); 24 string pStr5 = " Arya " ; 25 vecStr.push_back