kidnly explain what this piece of code will do:
vector<vector>(1001,vector());
I donβt think this is even a valid statement because the type of elements that the vector should contain is missing.
myMap = vector<vector>(1001,vector());
here you go
note: expected a type, got 'vector'
error: template argument 2 is invalid
error: missing template arguments before '(' token
auto myMap = vector<vector>(1001,vector());
^
This is what the C++ compiler spits out
myMap = vector<vector>(1001,vector());
You might want to do something like this:
auto myMap = vector<vector<int>>(1001,vector<int>());
1 Like
yes its correct kindly tell what it is doing
In variable myMap
, you are storing 1001
vectors of type int with default size each.
2 Likes