Remove the first element from deque - C++ STL

C++ examples for STL:deque

Description

Remove the first element from deque

Demo Code

#include <iostream> 
#include <deque> // deque class-template definition 
#include <algorithm> // copy algorithm 
#include <iterator> // ostream_iterator 
using namespace std; 

int main() //www .  j a  v a2 s  .com
{ 
    deque< double > values; // create deque of doubles 
    ostream_iterator< double > output( cout, " " ); 

    // insert elements in values 
    values.push_front( 2.2 ); 
    values.push_front( 3.5 ); 
    values.push_back( 1.1 ); 


    values.pop_front(); // remove first element 
    cout << "\nAfter pop_front, values contains: "; 
    copy( values.begin(), values.end(), output ); 

}

Result


Related Tutorials