Wednesday, 7 August 2013

How to push_back multiple values into a vector?

How to push_back multiple values into a vector?

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:

No comments:

Post a Comment