cannot convert 'std::vector<int>' to 'int' in initialization

I am try assign:

1
2
3
4
5
int temp= vsVol[a];  

being:

std::vector <std::vector <int> > vsVol (NUMHOST, std::vector<int>(NUMHOST));


and ocurrs the following error: cannot convert 'std::vector<int>' to 'int' in initialization

the entire code is:
1
2
3
4
5
6
7
void soma(const std::vector<int> & v, const std::vector<int> & vVol)
{  for (int i=0; i <NUMHOST; i++)
         if(v[i] == 1)
         {   int temp= vsVol[a];
             vsVol[a]= temp +1;
         }
}
vsVol is a vector of vectors. That means vsVol[a] is a vector.
you cannot assign vector to int.
The function soma() is rather curious for more than that error:
* v is vector, but you loop some global NUMHOST.
* vsVol and a are global.
* parameter vVol is not used.

Overall the loop seems to perform "count ones from v and add that amount to vsVol[a]".
Try [row][column] to get int
Topic archived. No new replies allowed.