求助!一个很简单的问题!
#include<iostream>#include<vector>
using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::vector<int>::iterator;
int main()
{
vector<int> CONTAINER;
for(int i=1;i<=4;i++)
CONTAINER.push_back(i);
cout<<"Here is what is in the container:\n";
iterator p;
for(p=CONTAINER.begin();p!=CONTAINER.end();p++)
cout<<*p<<" ";
cout<<endl;
cout<<"seting entries to 0:\n";
for(p=CONTAINER.begin();p!=CONTAINER.end();p++)
*p=0;
for(p=CONTAINER.begin();p!=CONTAINER.end();p++)
cout<<*p<<" ";
cout<<endl;
system("pause");
return 0;
}
e:\c++ pro\标准模块库\stl向量\stl向量\vector.cpp(7) : error C2885: “std::vector<_Ty>::iterator”: 在非类范围内不是有效的using 声明
老是出现这个错误……
但是我是从书上完全打上去的