]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/pop_front.rst
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / pop_front.rst
1 .. Sequences/Intrinsic Metafunctions//pop_front
2
3 pop_front
4 =========
5
6 Synopsis
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
21 Description
22 -----------
23
24 ``pop_front`` performs a removal at the beginning of the sequence with guaranteed |O(1)|
25 complexity.
26
27
28 Header
29 ------
30
31 .. parsed-literal::
32
33 #include <boost/mpl/pop_front.hpp>
34
35
36
37 Model of
38 --------
39
40 |Tag Dispatched Metafunction|
41
42
43 Parameters
44 ----------
45
46 +---------------+-----------------------------------+-----------------------------------------------+
47 | Parameter | Requirement | Description |
48 +===============+===================================+===============================================+
49 | ``Sequence`` | |Front Extensible Sequence| | A sequence to erase the first element from. |
50 +---------------+-----------------------------------+-----------------------------------------------+
51
52
53 Expression semantics
54 --------------------
55
56 For 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
75 Complexity
76 ----------
77
78 Amortized constant time.
79
80
81 Example
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
102 See 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)