# pop_front

### Synopsis

    template<
          typename Sequence
        >
    struct pop_front
    {
        typedef unspecified type;
    };

### Description

`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.

### Definition

    #include "boost/mpl/pop_front.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Extensible Sequence | A sequence to handle the erase operation

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef pop_front<Sequence>::type s;` | A model of Extensible Sequence | `empty<Sequence>::type::value == false` | Equivalent to `typedef erase< Sequence, begin<Sequence>::type >::type s;` | `size<s>::type::value == size<Sequence>::type::value - 1`

### Complexity

Amortized constant time [1].

### Example

    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);

### Notes

[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