1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
#include <iostream>
#include <tuple>
#include <vector>
#include <boost/algorithm/string.hpp>

template<typename IT, typename P>
auto my_find_if(IT begin, IT end, P& predicate) {
   while (begin != end) {
      if (predicate(*begin)) break;
      ++begin;
   }
   return begin;
}

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 = my_find_if(a.begin(), a.end(), look_for_hello);
   std::cout << "my_find_if stopped at: ";
   if (it != a.end()) {
      std::cout << "'" << *it << "'";
   } else {
      std::cout << "end";
   }
   std::cout << std::endl;
}