Possible Duplicate:
C++11 features in Visual Studio 2012
So I was reading up on C++11 initializer lists today via Wikipedia and saw that C++11 supports the following syntax for the standard containers:
std::vector<std::string> v = { "xyzzy", "plugh", "abracadabra" };
std::vector<std::string> v({ "xyzzy", "plugh", "abracadabra" });
std::vector<std::string> v{ "xyzzy", "plugh", "abracadabra" };
When I try the following in Visual Studio 2012 I get the compilation error C2552: 'vecs' : non-aggregates cannot be initialized with initializer list
Here is my code:
#include <vector>
using namespace std;
int main() {
vector<string> vecs = {"h", "g", "e"};
}
Does VS2012 not support initializer lists or am I just misunderstanding something?
Thanks!