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
Post a Comment