c++ - Compare vector iterator with integer -




string str = cpy[i].second; itr = find(v.begin(), v.end(), str); auto pos = distance(v.begin(), itr); //auto pos = itr - v.begin(); if(pos >= v.size() / 2)     cout << str << " "; else     cout << "-" << " "; 

here cpy vector of int , string pair, i.e, vector<pair<int,string>>cpy. above part gives error "pos not name type.".
how resolve it?

you can change type of pos int. think compiler doesn't support auto.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -