Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
STL Containers
bitset
deque
list
map
multimap
multiset
priority_queue
queue
set
stack
vector
deque
comparison operators
deque::deque
deque::~deque
member functions:
deque::assign
deque::at
deque::back
deque::begin
deque::clear
deque::empty
deque::end
deque::erase
deque::front
deque::get_allocator
deque::insert
deque::max_size
deque::operator=
deque::operator[]
deque::pop_back
deque::pop_front
deque::push_back
deque::push_front
deque::rbegin
deque::rend
deque::resize
deque::size
deque::swap


deque::pop_front

public member function
void pop_front ( );

Delete first element

Removes the first element in the deque container, effectively reducing the deque size by one.

This calls the removed element's destructor.

Parameters

none

Return value

none

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// deque::pop_front
#include <iostream>
#include <deque>
using namespace std;
int main ()
{
  deque<int> mydeque;
  int sum (0);
  mydeque.push_back (100);
  mydeque.push_back (200);
  mydeque.push_back (300);
  cout << "Popping out the elements in mydeque:";
  while (!mydeque.empty())
  {
    cout << " " << mydeque.front();
    mydeque.pop_front();
  }
  cout << "\nFinal size of mydeque is " << int(mydeque.size()) << endl;
  return 0;
}

Output:
Popping out the elements in mydeque: 100 200 300
Final size of mydeque is 0

Complexity

Constant.

See also