Standard C++ Library Class Reference
// Try both find_end variants.
//
iterator it3 = find_end (v1.begin(), v1.end(), v2.begin(),
v2.end());
iterator it4 = find_end (v1.begin(), v1.end(), v2.begin(),
v2.end(), equal_to<int>());
//
// Output results of find_first_of.
// Iterator now points to the first element that matches one of
// a set of values
//
cout << "For the vectors: ";
copy (v1.begin(), v1.end(), ostream_iterator<int>(cout," "));
cout << " and ";
copy (v2.begin(), v2.end(), ostream_iterator<int>(cout," "));
cout<< endl ,, endl
<< "both versions of find_first_of point to: "
<< *it1 << endl << "with first_of address = " << it1
<< endl ;
//
//Output results of find_end.
// Iterator now points to the first element of the last find
//subsequence.
//
cout << endl << endl
<< "both versions of find_end point to: "
<< *it3 << endl << "with find_end address = " << it3
<< endl ;
return 0;
}
Output :
For the vectors: 0 1 6 5 3 2 2 6 5 7 and 6 5
both versions of find_first_of point to: 6
with first_of address = 0x100005c0
both versions of find_end point to: 6
with find_end address = 0x100005d4
Warnings
If your compiler does not support default template parameters then you need to always supply the
Allocator template argument. For instance you'll have to write:
vector<int, allocator>
instead of:
vector<int>