I'm trying to use the std::find()
function on a std::vector
. Why does this code bring up an error, and how can I fix this?
struct person_id{
int p_id;
};
std::vector<person_id> people;
person_id tmp_person;
tmp_person.p_id = 5;
people.push_back(tmp_person);
if(std::find(people.begin(), people.end(), 5) != people.end()) {
cout<<"Contain"<<endl;
} else {
cout<<"Not Contain"<<endl;
}