ptrunf2.cpp

We use cookies. Read the Privacy and Cookie Policy

ptrunf2.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, ptr_fun(even));

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

 return 0;

}