#include <algorithm> #include <iostream> #include <vector> #include <boost/algorithm/string.hpp> auto str_equivalence_ignore_case(std::string text) { return [t = std::move(text)](const std::string& s) -> bool { return boost::iequals(s, t); }; } int main() { std::vector<std::string> a = {"hello", "Hallo", "willkommen"}; auto look_for_hello = str_equivalence_ignore_case("hallo"); auto it = std::find_if(a.begin(), a.end(), look_for_hello); std::cout << "std::find_if stopped at: "; if (it != a.end()) { std::cout << "'" << *it << "'"; } else { std::cout << "end"; } std::cout << std::endl; } |