c++ using std::vector<int>::iterator;编译错误
我照着书上的例子抄的代码,在codeblocks和vs2012中都提示错误。在vs2012中的信息是:notavalidusing-declarationatnon-cl...
我照着书上的例子抄的代码,在codeblocks和vs2012中都提示错误。在vs2012中的信息是:not a valid using-declaration at non-class scope。还望各位高手帮忙啊
#include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::vector;
using std::vector<int>::iterator;//错误:not a valid using-declaration at non-class scope
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;
} 展开
#include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::vector;
using std::vector<int>::iterator;//错误:not a valid using-declaration at non-class scope
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;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询