1
std::vector<int> test { 0x34 };

gives this error:

error expected a ';'

I am using VS2012 which supports this C++11 feature.

1
  • 1
    Did you #include <vector>? Commented Jun 8, 2013 at 14:53

1 Answer 1

2

Your code is perfectly legal in C++11. I must conclude you are not using November 2012's CTP, in which case your assumption:

I am using VS2012 which supports this C++11 feature.

is incorrect. This Q&A on StackOverflow clarifies which features are supported by VC11.

Notice, that uniform initialization is only supported in November 2012's CTP.

And while it is true that November 2012's CTP does introduce support for C++11's uniform initialization in the compiler (see this Q&A on StackOverflow for an overview of what features are supported), the implementation of the standard library which is shipped with VS2012 has not been rewritten to make use of those features (Error when initializing a vector).

Sign up to request clarification or add additional context in comments.

22 Comments

According to blogs.msdn.com/b/vcblog/archive/2012/11/02/… Nov12 CTP supported initializer lists.
@user2465415: Quote from the "important notes" section: This package contains only the compiler, and does not yet come with an updated standard library to use the features (such as a std::vector initializer_list constructor).
@Mat: Oh, OK, that explains. I'll have to edit the answer, thank you
Well, that's disappointing. Can anyone estimate how long that would take?
@user2465415: Indeed it seems MS is very much behind its competitors in this respect. I haven't read of any clear promises to catch up soon, although VS2013 should contain more C++11 features
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.