How to push_back multiple values into a vector?

c++, std, vector

Solution

Visual Studio 2012 does not support vector initialization via initializer lists. There is a lot of C++11 support missing from the standard library included with VS2012 that is supported by the VS2012 C++ compiler itself.

Sadly, as is the case for VS2012 and was the case for gcc 4.7, awesome compiler support for the new C++11 features is hampered by partial library support which seems to always lag behind the compiler.

Problem

I know this question has been asked before, and I know that in C++11 you can do ``` vector<int> v = {2,5,8,11,14}; vector<int> v{2,5,8,11,14}; ``` and ``` v.push_back({x,y}); ``` But it gives me a compile error. I'm using Visual Studio Express 2012. How do I accomplish this? EDIT: error screenshot attached:

Original source

Related problems