Search code examples
c++visual-c++c++11visual-c++-2012

Range-Based for loops in vs2012 rc


The following range-based for loop works fine in VS2012:

int values[] = {1, 2, 3};
for(int i: values)
{
}

However, this one doesn't work:

for(int i: {1, 2, 3})
{
}

What's the difference?

P.S.: I cannot find the std::initializer_list template class either. I need to know what C++11 features this new VS2012 RC supports. Any idea?


Solution

  • Visual C++ 2012 does not support initializer lists.

    The best resource for which C++11 features are supported in Visual C++ 2012 is this blog post on the Visual C++ blog.