jeudi 6 avril 2017

two dimension STL vector initialize

when I want to intialize a two dimension vector like this:

   #include<vector>

   using namespace std;

   int main()
   {
        vector<vector<int>> vec(10, vector<int>(10));
        vec.resize(10);
        for (auto it : vec) it.resize(10);
        return 0;
   }

it fails, can you tell me wgy?

Aucun commentaire:

Enregistrer un commentaire