]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/mpl/doc/src/refmanual/inserter_.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / inserter_.rst
CommitLineData
7c673cae
FG
1.. Algorithms/Inserters//inserter
2
3.. _`inserter_`:
4
5inserter (class)
6================
7
8Synopsis
9--------
10
11.. parsed-literal::
12
13 template<
14 typename State
15 , typename Operation
16 >
17 struct inserter
18 {
19 typedef State state;
20 typedef Operation operation;
21 };
22
23
24Description
25-----------
26
27A general-purpose model of the |Inserter| concept.
28
29
30Header
31------
32
33.. parsed-literal::
34
35 #include <boost/mpl/inserter.hpp>
36
37
38Model of
39--------
40
41|Inserter|
42
43
44Parameters
45----------
46
47+---------------+-------------------------------+-----------------------------------+
48| Parameter | Requirement | Description |
49+===============+===============================+===================================+
50| ``State`` | Any type | A initial state. |
51+---------------+-------------------------------+-----------------------------------+
52| ``Operation`` | Binary |Lambda Expression| | An output operation. |
53+---------------+-------------------------------+-----------------------------------+
54
55Expression semantics
56--------------------
57
58|Semantics disclaimer...| |Inserter|.
59
60For any binary |Lambda Expression| ``op`` and arbitrary type ``state``:
61
62+---------------------------+-------------------------------------------+
63| Expression | Semantics |
64+===========================+===========================================+
65| ``inserter<op,state>`` | An |Inserter|. |
66+---------------------------+-------------------------------------------+
67
68Complexity
69----------
70
71Amortized constant time.
72
73
74Example
75-------
76
77.. parsed-literal::
78
79 template< typename N > struct is_odd : bool_< ( N::value % 2 ) > {};
80
81 typedef copy<
82 range_c<int,0,10>
83 , inserter< // a filtering 'push_back' inserter
84 vector<>
85 , if_< is_odd<_2>, push_back<_1,_2>, _1 >
86 >
87 >::type odds;
88
89 BOOST_MPL_ASSERT(( equal< odds, vector_c<int,1,3,5,7,9>, equal_to<_,_> > ));
90
91
92See also
93--------
94
95|Algorithms|, |Inserter|, |Reversible Algorithm|, |front_inserter|, |back_inserter|
96
97.. |[inserter]| replace:: `inserter (class)`_
98
99
100