c++ maps doesnt work

for(auto it = x.end();it != x.begin();it++)
{
if(location >= 4){
if((it->first) + D[k-(next(it,1))->second] > (next(it,1))->first +D[k-(it->second)]){
D[k-(it->second)] = 0;
}
else{
D[k-((next(it,1))->second)] = 0;
}

im using net beans and im getting the following errors

error: 'it' does not name a type

error: expected ';' before 'it'

error: 'it' was not declared in this scope

BUILD FAILED (exit value 2, total time: 4s)
Sounds like you don't compile with C++11 support.

What compiler does the netbeans environment use?
Once you get the code compiled, you probably need to change this:
for(auto it = x.end();it != x.begin();it++)
to this
for(auto it = x.begin();it != x.end();it++)
Even then the code won't work since next() will return x.end() when you're processing the last item.
closed account (E0p9LyTq)
NetBeans and C++11 support question - NetBeans Forum
https://forums.netbeans.org/post-134485.html

c++ - Configuring C++11 in Netbeans - Stack Overflow
https://stackoverflow.com/questions/14867428/configuring-c11-in-netbeans

c++ - how do I add -std=c++11 to the compiler options in my Netbeans IDE - Stack Overflow
https://stackoverflow.com/questions/25683355/how-do-i-add-std-c11-to-the-compiler-options-in-my-netbeans-ide
Topic archived. No new replies allowed.