#include <iostream>
#include <vector>

bool es_par(int n) {
   return n % 2 == 0;
}

int busca_si(const std::vector<int>& a, auto pred) {
   for (int i = 0; i < a.size( ); ++i) {
      if (pred(a[i])) {
         return i;
      }
   }

   return -1;
}

int main( ) {
   std::vector<int> a = { 5, 1, 7, 8, 6 };

   int i = busca_si(a, es_par);
   if (i == -1) {
      std::cout << "no hay\n";
   } else {
      std::cout << a[i] << " (posicion " << i << ")\n";
   }
}
