迭代器在VC6中不能用?
程序代码:
#include <iostream> #include <vector> #include <string> using std:: cin; using std:: cout; using std:: endl; using std:: string; using std:: vector; int main() { vector<string> c; string s1; cout<< "enter strings"<<endl; while(cin >> s1) c.push_back(s1); char **prr = new char *[c.size()]; size_t ix = 0; for( vector<string>::iterator iter = c.begin();iter != c.end();++iter,++ix)//这地方老是报错 { char *p = new char[(*iter).size()+1]; strcpy(p,(*iter).c_str()); prr[ix]=p; } for(ix=0;ix!=c.size();++ix) delete [] prr; return 0; }