c++ - how to initialize the size of a two dimensional vector -
i trying initialize size of 2 dimensional vector way:
vector<vector<int> > a(10, vector<int>) ;
but when compile error:expected primary-expression before ')' token
why? correct way it?
in code vector defined inside structure. realise if define outside of structure problem disappears... why? need define in struct
perhaps
class inner : public vector<int> { public: inner() : vector<int>(10) { }; }; class outer : public vector<inner> { public: outer() vector<inner>(10) { }; };
then
outer a;
should work.
Comments
Post a Comment