I am trying to find if an object's attribute is in the vector. For example, if I have a vector of Car objects and the Car object have attributes of license, direction, and time. And I want to find if direction 'N' is in the vector of Car object. And return true or false if the attribute is in the vector of Cars.
This is the function I have so far, but I want to use the stl find() method to search for the attribute:
bool isIn(std::vector<Car *> c, std::string check){
for (auto i = 0; i < c.size(); i++)
{
if (c[i]->dir == check)
{
return true;
}
}
return false;
}
The arguments that are passed in are the vector of Cars and the direction.