#include <algorithm>
#include <numeric>
#include <list>
#include <cassert>
#include <vector>
#include <functional>
#include <iterator>
using namespace std;
class TwiceOver
{
public:
bool operator()(int val1, int val2)
{
return val1 == val2/2 ? true : false;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
int ia[] = { 1, 4, 4, 8 };
std::vector<int> vec(ia, ia + 4);
int *piter = NULL;
vector<int>::iterator iter;
piter = adjacent_find(ia, ia + 4);
assert(*piter == ia[1]);
iter = adjacent_find(vec.begin(), vec.end(), TwiceOver());
assert(*iter == vec[2]);
cout<<"ok: adjacent-find() succeeded!"<<endl;
system("pause");
return 0;
}