输出当前找到元素的下标
实例如下:
#include "stdafx.h"
#include <algorithm>
#include <vector>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
vector<int> vec;
vec.push_back(1);
vec.push_back(5);
vec.push_back(2);
vec.push_back(2);
vec.push_back(3);
vec.push_back(4);
auto itr = adjacent_find(vec.begin(), vec.end()); //2
if (itr != vec.end())
{
int index = distance(vec.begin(), itr); //结果为2
int y = 66;
}
return 0;
}