I have a map as follows:
std::map<int, std::unique_ptr<Person>> ratingMap; I want to create a function that takes a string argument _name and iterates through the map until it finds a person with the same name:
void Person::deleteFromMap(const std::string& _name){ //Searches the map for a person whose name is the same as the argument _name auto found = std::find(ratingMap.begin(), ratingMap.end(), [&](const std::unique_ptr<Person>& person) -> bool{return person->getName() == _name; }); However, this refuses to compile and gives the following error:
Error 1 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::pair' (or there is no acceptable conversion)
I've spent close to two hours trying variations of this in an attempt to get it to work, because I've written similar lambda functions in the past like this that have compiled and worked as expected. Why is this happening?