#include #include #include //for class string #include //for find_if #include //for bind2nd, mem_fun_ref #include //for compose1 using namespace std; int main() { const string a[] = {"", "hello", "goodbye"}; const size_t n = sizeof a / sizeof a[0]; const string *p = find_if(a, a + n, mem_fun_ref(&string::size)); 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), mem_fun_ref(&string::size) ) ); 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; }