vector的用法出警告
以下是我写的一段语句,可老是会报警告!
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
vector<string> *pstrvec=new vector<string>
pstrvec->push_back("abc");
pstrvec->push_back("def");
string str;
str=(*pstrvec)[0];
cout<<"the str is :"<<str<<endl;
int abc;
cin>>abc;
return 1;
}
当把*pstrvec 改成不是指针对象时也会报警告,而用一些内置的数据类型就不会,为什么啊