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