I have in my c++ code:
typedef vector<int> cards;
typedef vector<cards> rows;
typedef vector<rows> matriz;
and in my int main() , i try to initilizate a matriz called “cartas” with this line;
63 cin>>n>>m;
66 cartas(n,rows(m, cards(0)));
but, with g++, get out this error:
flip.cpp: In function ‘int main()’:
flip.cpp:66: error: no match for call to ‘(matriz) (int&, rows)’
i want to take a matriz of n*m, where in each position, there is vector of integers.
thanks, now, i don’t see it how.
Is your code by any chance similar to:
?
That won’t work,
matriz cartas;is already an initialization. Either definecartazafter thecinstatement, or assign afterwards.Optimal:
Alternative: