• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Sequences/Intrinsic Metafunctions//pop_front
2
3pop_front
4=========
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename Sequence
13        >
14    struct pop_front
15    {
16        typedef |unspecified| type;
17    };
18
19
20
21Description
22-----------
23
24``pop_front`` performs a removal at the beginning of the sequence with guaranteed |O(1)|
25complexity.
26
27
28Header
29------
30
31.. parsed-literal::
32
33    #include <boost/mpl/pop_front.hpp>
34
35
36
37Model of
38--------
39
40|Tag Dispatched Metafunction|
41
42
43Parameters
44----------
45
46+---------------+-----------------------------------+-----------------------------------------------+
47| Parameter     | Requirement                       | Description                                   |
48+===============+===================================+===============================================+
49| ``Sequence``  | |Front Extensible Sequence|       | A sequence to erase the first element from.   |
50+---------------+-----------------------------------+-----------------------------------------------+
51
52
53Expression semantics
54--------------------
55
56For any |Front Extensible Sequence| ``s``:
57
58.. parsed-literal::
59
60    typedef pop_front<s>::type r;
61
62:Return type:
63    |Front Extensible Sequence|.
64
65:Precondition:
66    ``empty<s>::value == false``.
67
68:Semantics:
69    Equivalent to ``erase<s,begin<s>::type>::type;``.
70
71:Postcondition:
72    ``size<r>::value == size<s>::value - 1``.
73
74
75Complexity
76----------
77
78Amortized constant time.
79
80
81Example
82-------
83
84.. parsed-literal::
85
86    typedef vector<long>::type types1;
87    typedef vector<int,long>::type types2;
88    typedef vector<char,int,long>::type types3;
89
90    typedef pop_front<types1>::type result1;
91    typedef pop_front<types2>::type result2;
92    typedef pop_front<types3>::type result3;
93
94    BOOST_MPL_ASSERT_RELATION( size<result1>::value, ==, 0 );
95    BOOST_MPL_ASSERT_RELATION( size<result2>::value, ==, 1 );
96    BOOST_MPL_ASSERT_RELATION( size<result3>::value, ==, 2 );
97
98    BOOST_MPL_ASSERT(( is_same< front<result2>::type, long > ));
99    BOOST_MPL_ASSERT(( is_same< front<result3>::type, int > ));
100
101
102See also
103--------
104
105|Front Extensible Sequence|, |erase|, |push_front|, |front|, |pop_back|
106
107
108.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
109   Distributed under the Boost Software License, Version 1.0. (See accompanying
110   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
111