Reputation: 4273
I am trying to initialize an array of vectors. How can I do that ?
The following code is wrong:
vector<int> A[] = vector<int>()[10];
Upvotes: 1
Views: 1786
Reputation: 2440
std::array<std::vector<int>, 10>
This will gives you an array of 10 with vectors in it.
Upvotes: 4
Reputation: 72271
Try just
vector<int> A[10];
It will default-initialize all ten vector
objects.
Upvotes: 2