Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.



      typename Sequence
struct pop_front
    typedef unspecified type;


pop_front performs a removal at the beginning of the sequence. The algorithm returns a new sequence which contains all the elements in the range [next< begin<Sequence>::type >::type, end<Sequence>::type). The result sequence preserves all the functional and performance characteristics of the original Sequence, except its size and identity.


#include "boost/mpl/pop_front.hpp"


 Parameter  Requirement  Description  
SequenceA model of Extensible SequenceA sequence to handle the erase operation

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef pop_front<Sequence>::type s;A model of Extensible Sequenceempty<Sequence>::type::value == falseEquivalent to typedef erase< Sequence, begin<Sequence>::type >::type s;size<s>::type::value == size<Sequence>::type::value - 1


Amortized constant time [1].


typedef list<long>::type types1;
typedef list<int,long>::type types2;
typedef list<char,int,long>::type types3;

typedef pop_front<types1>::type result1; typedef pop_front<types2>::type result2; typedef pop_front<types3>::type result3;

BOOST_STATIC_ASSERT(size<result1>::type::value == 0); BOOST_STATIC_ASSERT(size<result2>::type::value == 1); BOOST_STATIC_ASSERT(size<result3>::type::value == 2);

BOOST_MPL_ASSERT_IS_SAME(front<result2>::type, long); BOOST_MPL_ASSERT_IS_SAME(front<result3>::type, int);


[1] The algorithm is provided only if the sequence can meet the stated complexity requirements.

See also

Extensible Sequence, erase, push_front, front, pop_back

Table of Contents
Last edited July 17, 2002 3:54 am