I was working on a little C++ project at home, which I brought into school to show my teacher. At home I have Visual Studio 2012, whereas the school computers have Visual Studio
C++11 range-based for loops aren't supported in Visual Studio 2010.
The second form is a syntax that leaked into the compiler from C++/CLI (an entirely different language that targets the .NET runtime). I filled a bug on this a while back. If you compile with the /Za
switch, it will disable this language extension. You will need to use the C++03 for loop syntax using an iterator or std::for_each
.