When initializing vector of vectors, why don't we write:
vector<vector<int>> v;
v.assign(10, vector<int>);
but we need to write:
v.assign(10, vector<int>());
When initializing vector of vectors, why don't we write:
vector<vector<int>> v;
v.assign(10, vector<int>);
but we need to write:
v.assign(10, vector<int>());
You appear to have conflated types with objects (aka values). They are not the same things.
vector<int> is talking about a type, not an actual piece of data. For example, what would you expect to happen in this case?
vector<double> v;
v.assign(10, double);
It's the same thing, except using double as the type name rather than vector<int>. You can even do this:
vector<double> v;
v.assign(10, double());
What double() means is "Construct a new value of type double using the default double constructor.". The default constructor for double happens to give it the value 0.0.
And what vector<int>() means is the same thing. It's saying "Make me a new value of type vector<int> initialized using the default constructor." which happens to make a new vector<int> with 0 elements.
As a side note, what I told you about double having a 'default constructor' is not technically true in the most exacting definition what a constructor is. But, if you're getting confused by the code you're writing right now, that distinction is immaterial. Sort of like learning in your high school chemistry class that electrons technically do not orbit the nucleus.