T
Tony Young
Hi,
I wonder if there is a way to declare and initialize a vector in one
line as one does for array (shown below):
int n[4] = {1, 2, 3, 4};
The one line should be equivalent to the following code:
vector<int> n;
n.resize(4);
for (int i=0; i<4; i++)
n = i+1;
Any help is appreciated.
JD
I wonder if there is a way to declare and initialize a vector in one
line as one does for array (shown below):
int n[4] = {1, 2, 3, 4};
The one line should be equivalent to the following code:
vector<int> n;
n.resize(4);
for (int i=0; i<4; i++)
n = i+1;
Any help is appreciated.
JD