小编Muk*_*and的帖子

auto 关键字在 Dev C++ 中不起作用

这是我编写的代码,用于查看auto关键字如何工作,但它没有在 Dev C++ 中编译并给出以下警告: [警告] C++11 auto only available with -std=c++11 or -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;
    }
}
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors vector dev-c++ auto

4
推荐指数
1
解决办法
7464
查看次数

标签 统计

auto ×1

c++ ×1

compiler-errors ×1

dev-c++ ×1

vector ×1