<分区>
这是我编写的代码,用于查看 auto
关键字如何工作,但它没有在 Dev C++ 中编译并给出以下警告:
[警告] C++11 auto 仅适用于 -std=c++11 或 -std=gnu++11
如何克服这个故障并按照警告的指示去做?
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
std::vector<auto> v={2,-1,4,6,7};
auto beg = v.begin();
while (beg != v.end())
{
++beg;
cout<<beg;
}
}