array of vector<int>

Jun 29, 2011 at 2:49am
vector<int> v(5) creates a vector<int> v of size 5

vector<int> v[5] creates an array v of 5 vector<int>'s

What if we want an array v of 5 vector<int>'s of size 5?
Jun 29, 2011 at 3:13am
In general, it's not possible to pass parameters to constructors of objects in arrays. In this particular case, this may work (I wouldn't be surprised if it didn't):
std::vector<int> v[]={5,5,5,5,5};
Topic archived. No new replies allowed.