Step 3 of 6
find_if, count_if, any_of
Algorithms that take a predicate (a function returning bool):
auto it = std::find_if(v.begin(), v.end(), [](int x) { return x < 0; });
if (it != v.end()) { /* *it is the first negative */ }
int n = std::count_if(v.begin(), v.end(), [](int x) { return x % 2 == 0; });
bool any = std::any_of(v.begin(), v.end(), [](int x) { return x > 100; });
Your turn: write int count_headshots(const std::vector<std::string>& kills) counting entries that end with "_hs", using std::count_if and a lambda.