I am working with vectors and I am initialising them like so:
vector<int> values;
values.push_back(1);
values.push_back(2);
values.push_back(8);
values.push_back(12);
values.push_back(32);
values.push_back(43);
values.push_back(23);
values.push_back(234);
values.push_back(7);
values.push_back(1);
Is there a way, to push_back these elements in a way that is array-like? Like this:
int numbers[2] = {1, 2};
The vector method takes up too many lines, IMO!
In C++11 you can use brace initialization with any container.
In C++03 you can do this
or use boost assign.