#include #include #include //for strlen #include //for find_if #include //for bind2nd, ptr_fun #include //for compose1 using namespace std; int main() { const char *const a[] = {"", "hello", "goodbye"}; const size_t n = sizeof a / sizeof a[0]; const char *const *p = find_if(a, a + n, strlen); if (p == a + n) { cout << "Every string was of length 0.\n"; } else { cout << "The first non-empty string was a[" << p - a << "] == \"" << *p << "\".\n"; } p = find_if(a, a + n, __gnu_cxx::compose1( bind2nd(equal_to(), 7), ptr_fun(strlen) ) ); if (p == a + n) { cout << "No string was of length 7.\n"; } else { cout << "The first string of length 7 was a[" << p - a << "] == \"" << *p << "\".\n"; } return EXIT_SUCCESS; }