Visual C++ 2010 akzeptiert:Ist "für jeden" Microsoft spezifisch?
std::vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
for each (auto i in v)
std::cout << i << std::endl;
Ist das eine C++ 11-Funktion oder eine Microsoft-Erweiterung? Nach Wikipedia, die Syntax von C++ 11 der for-Schleife jedes andere:
int myint[] = {1,2,3,4,5};
for (int& i: myint)
{
std::cout << i;
}
mögliche Duplikat von [Visual C++ "für jede" Portabilität] (http://stackoverflow.com/questions/197375/visual-c-for-e-ach-portability) – kennytm