This documentation is archived and is not being maintained.

deque::pop_back 

Deletes the element at the end of the deque.


void pop_back( );

The last element must not be empty. pop_back never throws an exception.

// deque_pop_back.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

int main( ) 
{
   using namespace std;
   deque <int> c1;
   
   c1.push_back( 1 );
   c1.push_back( 2 );
   cout << "The first element is: " << c1.front( ) << endl;
   cout << "The last element is: " << c1.back( ) << endl;

   c1.pop_back( );
   cout << "After deleting the element at the end of the deque, the "
      "last element is: " << c1.back( ) << endl;
}

The first element is: 1
The last element is: 2
After deleting the element at the end of the deque, the last element is: 1

Header: <deque>

Show: