E
Erik Borgstr?m
Hi,
Yes, I have followed some of the discussion on vector<vector<int> >,
but perhaps I'm just blind. I want to use a vector<vector<int> > of
outer size n and inner size m. Are these correct ways to achieve this?
1.
vector<vector<int> > v(n);
for(int i=0;i<n;i++){
v = vector<int>(m);
}
2.
vector<int> smallvec(m);
vector<vector<int> > v(n, smallvec);
3.
vector<vector<int> > v(n, vector<int>(m));
Also, what's the preferred way?
thanks,
Erik
Yes, I have followed some of the discussion on vector<vector<int> >,
but perhaps I'm just blind. I want to use a vector<vector<int> > of
outer size n and inner size m. Are these correct ways to achieve this?
1.
vector<vector<int> > v(n);
for(int i=0;i<n;i++){
v = vector<int>(m);
}
2.
vector<int> smallvec(m);
vector<vector<int> > v(n, smallvec);
3.
vector<vector<int> > v(n, vector<int>(m));
Also, what's the preferred way?
thanks,
Erik