Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::deque

 

std::deque (an abbreviation of 'double-ended queue', pronounce 'deck') is a container to store elements in a double-ended queue.

 

#include <algorithm> //std::copy
#include <deque> //std::deque
#include <iostream> //std::cout
#include <iterator> //std::ostream_iterator
#include <string> //std::string

int main()
{
  std::deque<std::string> q;
  q.push_back("I am first");
  q.push_front("I get added in the front");
  q.push_back("I get added in the back");
  //Display q
  std::copy(q.begin(),q.end(),std::ostream_iterator<std::string>(std::cout,"\n"));
}


 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict