]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/proto/doc/reference/transform/fold.xml
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / proto / doc / reference / transform / fold.xml
CommitLineData
7c673cae
FG
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 Copyright 2012 Eric Niebler
4
5 Distributed under the Boost
6 Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 -->
9<header name="boost/proto/transform/fold.hpp">
10 <para>Contains definition of the
11 <computeroutput>
12 <classname alt="boost::proto::fold">proto::fold&lt;&gt;</classname>
13 </computeroutput> and
14 <computeroutput>
15 <classname alt="boost::proto::reverse_fold">proto::reverse_fold&lt;&gt;</classname>
16 </computeroutput>
17 transforms.</para>
18 <namespace name="boost">
19 <namespace name="proto">
20 <struct name="fold">
21 <template>
22 <template-type-parameter name="Sequence"/>
23 <template-type-parameter name="State0"/>
24 <template-type-parameter name="Fun"/>
25 </template>
26 <inherit>
27 <classname>proto::transform</classname>&lt; fold&lt;Sequence, State0, Fun&gt; &gt;</inherit>
28 <purpose>A <conceptname>PrimitiveTransform</conceptname> that invokes the
29 <computeroutput>fusion::fold&lt;&gt;</computeroutput> algorithm to accumulate a value.</purpose>
30 <description>
31 <para>
32 For the complete description of the behavior of the <computeroutput>proto::fold&lt;&gt;</computeroutput>
33 transform, see the documentation for the nested <computeroutput>
34 <classname>proto::fold::impl&lt;&gt;</classname>
35 </computeroutput> class template.
36 </para>
37 </description>
38 <struct name="impl">
39 <template>
40 <template-type-parameter name="Expr"/>
41 <template-type-parameter name="State"/>
42 <template-type-parameter name="Data"/>
43 </template>
44 <inherit><classname>proto::transform_impl</classname>&lt; Expr, State, Data &gt;</inherit>
45 <typedef name="X">
46 <purpose>For exposition only</purpose>
47 <type><classname>when</classname>&lt;<classname>_</classname>, Sequence&gt;</type>
48 </typedef>
49 <typedef name="Y">
50 <purpose>For exposition only</purpose>
51 <type><classname>when</classname>&lt;<classname>_</classname>, State0&gt;</type>
52 </typedef>
53 <typedef name="seq">
54 <purpose>A Fusion sequence, for exposition only</purpose>
55 <type>typename boost::result_of&lt;X(Expr, State, Data)&gt;::type</type>
56 </typedef>
57 <typedef name="state0">
58 <purpose>An initial state for the fold, for exposition only</purpose>
59 <type>typename boost::result_of&lt;Y(Expr, State, Data)&gt;::type</type>
60 </typedef>
61 <typedef name="fun">
62 <purpose><computeroutput>fun(d)(s,e) == when&lt;_,Fun&gt;()(e,s,d)</computeroutput></purpose>
63 <type><emphasis>unspecified</emphasis></type>
64 </typedef>
65 <typedef name="result_type">
66 <type>typename fusion::result_of::fold&lt;seq, state0, fun&gt;::type</type>
67 </typedef>
68 <method-group name="public member functions">
69 <method name="operator()" cv="const">
70 <type>result_type</type>
71 <parameter name="expr">
72 <paramtype>typename impl::expr_param</paramtype>
73 <description>
74 <para>The current expression </para>
75 </description>
76 </parameter>
77 <parameter name="state">
78 <paramtype>typename impl::state_param</paramtype>
79 <description>
80 <para>The current state </para>
81 </description>
82 </parameter>
83 <parameter name="data">
84 <paramtype>typename impl::data_param</paramtype>
85 <description>
86 <para>An arbitrary data </para>
87 </description>
88 </parameter>
89 <description>
90 <para>
91 Let <computeroutput>seq</computeroutput> be
92 <computeroutput><classname>when</classname>&lt;<classname>_</classname>, Sequence&gt;()(expr, state, data)</computeroutput>,
93 let <computeroutput>state0</computeroutput> be
94 <computeroutput><classname>when</classname>&lt;<classname>_</classname>, State0&gt;()(expr, state, data)</computeroutput>,
95 and let <computeroutput>fun(data)</computeroutput> be an object such that
96 <computeroutput>fun(data)(state, expr)</computeroutput> is equivalent to
97 <computeroutput><classname>when</classname>&lt;<classname>_</classname>, Fun&gt;()(expr, state, data)</computeroutput>. Then,
98 this function returns <computeroutput>fusion::fold(seq, state0, fun(data))</computeroutput>.
99 </para>
100 </description>
101 </method>
102 </method-group>
103 </struct>
104 </struct>
105
106 <struct name="reverse_fold">
107 <template>
108 <template-type-parameter name="Sequence"/>
109 <template-type-parameter name="State0"/>
110 <template-type-parameter name="Fun"/>
111 </template>
112 <inherit><classname>proto::fold</classname>&lt; <classname>proto::_reverse</classname>(Sequence), State0, Fun &gt;</inherit>
113 <purpose>
114 A <conceptname>PrimitiveTransform</conceptname> that is the same as the <computeroutput><classname>proto::fold&lt;&gt;</classname></computeroutput>
115 transform, except that it folds back-to-front instead of front-to-back. It uses the
116 <computeroutput>
117 <classname>proto::_reverse</classname>
118 </computeroutput> callable <conceptname>PolymorphicFunctionObject</conceptname> to create a
119 <computeroutput>fusion::reverse_view&lt;&gt;</computeroutput> of the sequence before invoking
120 <computeroutput>fusion::fold&lt;&gt;</computeroutput>.
121 </purpose>
122 </struct>
123 </namespace>
124 </namespace>
125</header>