]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/mpl/doc/src/refmanual/push_back.rst
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / push_back.rst
CommitLineData
7c673cae
FG
1.. Sequences/Intrinsic Metafunctions//push_back
2
3push_back
4=========
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11 template<
12 typename Sequence
13 , typename T
14 >
15 struct push_back
16 {
17 typedef |unspecified| type;
18 };
19
20
21
22Description
23-----------
24
25``push_back`` performs an insertion at the end of the sequence with guaranteed |O(1)|
26complexity.
27
28Header
29------
30
31.. parsed-literal::
32
33 #include <boost/mpl/push_back.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`` | |Back Extensible Sequence| | A sequence to insert into. |
50+---------------+-------------------------------+-----------------------------------------------+
51| ``T`` | Any type | The element to be inserted. |
52+---------------+-------------------------------+-----------------------------------------------+
53
54
55Expression semantics
56--------------------
57
58For any |Back Extensible Sequence| ``s`` and arbitrary type ``x``:
59
60
61.. parsed-literal::
62
63 typedef push_back<s,x>::type r;
64
65:Return type:
66 |Back Extensible Sequence|.
67
68:Semantics:
69 Equivalent to
70
71 .. parsed-literal::
72
73 typedef insert< s,end<s>::type,x >::type r;
74
75
76:Postcondition:
77 ``back<r>::type`` is identical to ``x``;
78
79 .. parsed-literal::
80
81 size<r>::value == size<s>::value + 1
82
83
84Complexity
85----------
86
87Amortized constant time.
88
89
90Example
91-------
92
93.. parsed-literal::
94
95 typedef vector_c<bool,false,false,false,
96 true,true,true,false,false> bools;
97
98 typedef push_back<bools,false_>::type message;
99
100 BOOST_MPL_ASSERT_RELATION( back<message>::type::value, ==, false );
101 BOOST_MPL_ASSERT_RELATION(
102 ( count_if<message, equal_to<_1,false_> >::value ), ==, 6
103 );
104
105
106See also
107--------
108
109|Back Extensible Sequence|, |insert|, |pop_back|, |back|, |push_front|
110
111
112