Use generic deque to store integers : deque « Deque « C++






Use generic deque to store integers

  
 

#include <iostream>
#include <cassert>
#include <deque>
#include <algorithm>  // For find
using namespace std;


int main()
{
  int x[5] = {1, 2, 3, 4, 5};

  deque<int> deque1(&x[0], &x[5]);

  // Search for the first occurrence of the letter e:
  deque<int>::iterator where = find(deque1.begin(), deque1.end(), 1);

  cout << *where << endl;
  return 0;
}
 
/* 
1

 */
        
    
  








Related examples in the same category

1.Use generic deque to store chars
2.Use generic deque to store strings
3.Initialize deque with 26 copies of the letter x
4.create a deque
5.Use std::copy to print out all elements in a deque
6.deque.push_back( value )
7.deque.push_front( value )
8.Create your own stack based on deque
9.Combine insert and end to add elements to a deque
10.Save transformed data from vector to deque (Vector1 + Vector2 = Result (in Deque))