in c++ I have
vector > table;
How can I resize vector so that it has 3 rows and 4 columns, all zeros?
Someth
You can pass an explicit default value to the constructor:
vector example(100, "example");
vector> table (3, vector(4));
vector>> notveryreadable (3, vector>(4, vector (5, 999)));
The last one is more readable if it's built "piecewise":
vector dimension1(5, 999);
vector> dimension2(4, dimension1);
vector>> dimension3(3, dimension2);
particularly if you use explicit std::
- code that looks like
std::vector>> lol(3, std::vector>(4, std::vector (5, "lol")));
should be reserved for bad jokes.