dimanche 23 avril 2023

c++ how to create 2d vector in heap?

I know I can create 2d vector in the stack for

 vector<vector<int>> dp(10,vector<int>(10,0));

But the question is, how do I create that in heap?

can I do something like?

vector<vector<int>> dp(10,vector<int>(10,0)) = new vector<vector<int>>(10,vector<int>(10,0));

Aucun commentaire:

Enregistrer un commentaire