samedi 30 juin 2018

I'm getting " no match for 'operator[]' 'std::vector

vector<int>g2[10000];
    for(int u=0;u<N;u++) //N is the number of vertices
      { for(vector<int>::iterator it=v[u].begin();it!=v[u].end();it++) 
          {g2[v[*it]].push_back(u);}}

//v is of vectorv[1000],it consists a adjaceny list representation of a graph

Im getting the error->

     prog.cpp:74:8: error: no match for 'operator[]' (operand types are 'std::vector<int> [10001]' and 'std::vector<int>')
   g2[v[*it]].push_back(u);
    ^    

can you guys please help me!

Aucun commentaire:

Enregistrer un commentaire