// Demonstrating the generic find algorithm with a list #include #include #include #include // for find using namespace std; template Container make(const char s[]) { return Container(&s[0], &s[strlen(s)]); } int main() { cout << "Demonstrating generic find algorithm with " << "a list." << endl; list list1 = make< list >("C++ is a better C"); // Search for the first occurrence of the letter e: list::iterator where = find(list1.begin(), list1.end(), 'e'); list::iterator next = where; ++next; assert (*where == 'e' && *next == 't'); cout << " --- Ok." << endl; return 0; }