Combine insert and end to add elements to a deque : deque « Deque « C++






Combine insert and end to add elements to a deque

  
 

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

int main()
{
  deque<string> deq;

  deq.insert(deq.end(), "AAA");
  deq.insert(deq.end(), "DDDDDD");

  deque<string>::iterator pos;


  for (pos=deq.begin(); pos!=deq.end(); ++pos) {
        cout << *pos << ' ';
  }

  return 0;
}

 /* 
AAA DDDDDD
 */       
    
  








Related examples in the same category

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