Visual c++ “for each” portability

I wouldn’t use that. While it’s a tempting feature, the syntax is incompatible with the upcoming C++0x standard, which uses:

list<Object> myList;

for (Object o : myList)
{
   o.foo();
}

to do the same thing.

Leave a Comment