In C++, say you have a std::map<int,int>
- how would you use stl
algorithms/libraries to find if there is a key
that satisfies a certain predicate, e.g. finding if there is a key
that is an odd number. So far I've got:
auto variable = std::find_if(my_map.begin(),my_map.end(), [](const auto& element) -> bool {return element%2 == 1;})
if (variable == my_map.end() .....
But how do I make sure the parameter in the predicate function is actually the key?