#include <iostream>
#include <deque>
#include <algorithm>
using std::cout;
using std::endl;
using std::deque;
int main()
{
deque<int> dq = { 1, 3, 2, 1, 4, 4, 4, 6, 4, 4 };
deque<int>::iterator pos;
pos = search_n(dq.begin(), dq.end(), 3, 4);
if (pos != dq.end())
cout << "start in index: " << distance(dq.begin(), pos) << endl;
else
cout << "not found" << endl;
return 0;
}
/*
run:
start in index: 4
*/