ptrunf1.cpp

ptrunf1.cpp

#include ‹iostream.h›

#include ‹stl.h›

bool even(int n_) {

 return (n_ % 2) == 0;

}

int array[3] = {1, 2, 3};

int main() {

 int* p = find_if(array, array + 3, pointer_to_unary_function‹int, bool›(even));

 if (p != array + 3) cout ‹‹ *p ‹‹ " is even" ‹‹ endl;

 return 0;

}