// Using find with normal and reverse iteration #include #include #include // for find #include using namespace std; template Container make(const char s[]) { return Container(&s[0], &s[strlen(s)]); } int main() { cout << "Using find with normal and reverse iteration:\n"; vector vector1 = make< vector >("now is the time"); ostream_iterator out(cout, " "); vector::iterator i = find(vector1.begin(), vector1.end(), 't'); cout << "chars from the first t to the end: "; copy(i, vector1.end(), out); cout << endl; cout << "chars from the last t to the beginning: "; vector::reverse_iterator r = find(vector1.rbegin(), vector1.rend(), 't'); copy(r, vector1.rend(), out); cout << endl; cout << "chars from the last t to the end: "; copy(r.base() - 1, vector1.end(), out); cout << endl; return 0; }