Currently in a large c++ project we are working on we have a bunch of the new style for loops like the following:
for (auto& value : values)
Up till now we have been compiling exclusively with gcc 4.6. Recently some of the codebase is being ported to windows and some of the developers want to compile in msvc++ 10 but it seems as though the new for loop syntax is not fully supported yet.
It would be highly desirable to not have to re-write all the places where this syntax occurs.
What is the best way to work around this problem?
Update: It looks as though this issue is resolved in MSVC11.
You could use Boost.Foreach:
//Using Xeo's example:
BOOST_FOREACH (auto& e, values) {
std::cout << e << " ";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With