template <class ForwardIterator1, class ForwardIterator2> void find_end( ForwardIterator1 xFirst1, ForwardIterator1 xLast1, ForwardIterator1 xFirst2, ForwardIterator1 xLast2 );
#include <algorithm>
template <class ForwardIterator1, class ForwardIterator2, class Predicate> void find_end( ForwardIterator1 xFirst1, ForwardIterator1 xLast1, ForwardIterator1 xFirst2, ForwardIterator1 xLast2, Predicate xTest );
#include <iostream> #include <vector> #include <algorithm> int main() { using namespace std; // Create a vector instance vector<char> qV; qV.push_back('X'); qV.push_back('o'); qV.push_back('a'); qV.push_back('X'); qV.push_back('.'); qV.push_back('n'); qV.push_back('e'); qV.push_back('t'); vector<char>::iterator qIter; // Output the vector cout << "Vector: "; for (qIter = qV.begin(); qIter != qV.end(); ++qIter) { cout << *qIter; } cout << endl; // Search for the range cout << "Searching for: "; for (qIter = qV.begin() + 3; qIter != qV.begin() + 5; ++qIter) { cout << *qIter; } cout << endl; qIter = find_end(qV.begin(), qV.end(), qV.begin() + 3, qV.begin() + 5); // Output the vector after the find cout << "Found entries and beyond: "; for (; qIter != qV.end(); ++qIter) { cout << *qIter; } cout << endl; // Keep the window open cin.get(); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.