Illustrating the generic search algorithm: Search for first occurrence of deque's contents as a subsequence of the vector contents : deque find « deque « C++ Tutorial






#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
#include <deque>
using namespace std;

int main()
{
  vector<int> vector1(20);
  deque<int>  deque1(5);

  int i;
  for (i = 0; i < 20; ++i) 
    vector1[i] = i;

  for (i = 0; i < 5; ++i) 
    deque1[i] = i + 5;


  vector<int>::iterator k = search(vector1.begin(), vector1.end(), deque1.begin(), deque1.end());

  for (i = 0; i < 5; ++i) 
    cout <<  *(k + i);

  return 0;
}
56789








22.5.deque find
22.5.1.Use find the search an element in deque
22.5.2.Illustrating the generic search algorithm: Search for first occurrence of deque's contents as a subsequence of the vector contents