In this what is the purpose of newfunction? Why don't its existence makes any change ?
Can anyone help me out please ?
#include <iostream>
#include <algorithm>
#include <vector>
bool newfunction (int m, int n)
{
return (m==n);
}
int main ()
{
int newints[] = {1,2,3,4,5,1,2,3,4,5};
std::vector<int> haystack (newints,newints+10);
int patt1[] = {1,2,3};
std::vector<int>::iterator ti;
ti = std::find_end (haystack.begin(), haystack.end(), patt1, patt1+3);
if (ti!=haystack.end())
std::cout << "patt1 last found at position " << (ti-haystack.begin()) << '\n';
int patt2[] = {4,5,1};
ti = std::find_end (haystack.begin(), haystack.end(), patt2, patt2+3, newfunction);
if (ti!=haystack.end())
std::cout << "patt2 last found at position " << (ti-haystack.begin()) << '\n';
return 0;
}
Aucun commentaire:
Enregistrer un commentaire