This was a code I wrote to see how auto
keyword works but it didn't got compiled in Dev C++ and gave the following warning:
[Warning] C++11 auto only available with -std=c++11 or -std=gnu++11
How to overcome this glitch and do what the warning tells to do?
#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;
}
}
You need to enable c++11 in the compiler using the switch instructions can be found here: How to change mode from c++98 mode in Dev-C++ to a mode that supports C++0x (range based for)?