• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Struct template impl</title>
6<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../make.html#id-1.3.33.5.52.6.4" title="Description">
10<link rel="prev" href="../make.html" title="Struct template make">
11<link rel="next" href="../pass_through.html" title="Struct template pass_through">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
16<td align="center"><a href="../../../../../index.html">Home</a></td>
17<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="../make.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../make.html#id-1.3.33.5.52.6.4"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../pass_through.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.proto.make.impl"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Struct template impl</span></h2>
30<p>boost::proto::make::impl</p>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../proto/reference.html#header.boost.proto.transform.make_hpp" title="Header &lt;boost/proto/transform/make.hpp&gt;">boost/proto/transform/make.hpp</a>&gt;
34
35</span>
36<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <a class="link" href="../../../Expr.html" title="Concept Expr">Expr</a><span class="special">,</span> <span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Data<span class="special">&gt;</span>
37<span class="keyword">struct</span> <a class="link" href="impl.html" title="Struct template impl">impl</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="../transform_impl.html" title="Struct template transform_impl">proto::transform_impl</a><span class="special">&lt;</span> <span class="identifier">Expr</span><span class="special">,</span> <span class="identifier">State</span><span class="special">,</span> <span class="identifier">Data</span> <span class="special">&gt;</span> <span class="special">{</span>
38  <span class="comment">// <a class="link" href="impl.html#boost.proto.make.impltypes">types</a></span>
39  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">see</span><span class="special">-</span><span class="identifier">below</span></em></span> <a class="link" href="impl.html#boost.proto.make.impl.result_type"><span class="identifier">result_type</span></a><span class="special">;</span>
40
41  <span class="comment">// <a class="link" href="impl.html#id-1_3_33_5_50_2_1_3_5_4-bb">public member functions</a></span>
42  <span class="identifier">result_type</span> <a class="link" href="impl.html#id-1_3_33_5_50_2_1_3_5_4_1-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">impl</span><span class="special">::</span><span class="identifier">expr_param</span><span class="special">,</span>
43                         <span class="keyword">typename</span> <span class="identifier">impl</span><span class="special">::</span><span class="identifier">state_param</span><span class="special">,</span>
44                         <span class="keyword">typename</span> <span class="identifier">impl</span><span class="special">::</span><span class="identifier">data_param</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
45<span class="special">}</span><span class="special">;</span></pre></div>
46<div class="refsect1">
47<a name="id-1.3.33.5.52.6.4.4.4"></a><h2>Description</h2>
48<div class="refsect2">
49<a name="id-1.3.33.5.52.6.4.4.4.2"></a><h3>
50<a name="boost.proto.make.impltypes"></a><code class="computeroutput">impl</code>
51        public
52       types</h3>
53<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
54<p>
55<span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">see</span><span class="special">-</span><span class="identifier">below</span></em></span> <a name="boost.proto.make.impl.result_type"></a><span class="identifier">result_type</span><span class="special">;</span></p>
56<p>
57                <code class="computeroutput"><a class="link" href="../make.html" title="Struct template make">proto::make</a>&lt;T&gt;::impl&lt;Expr, State, Data&gt;::result_type</code> is
58                computed as follows:
59              </p>
60<p>
61                If <code class="computeroutput">T</code> is an <a class="link" href="../../../ObjectTransform.html" title="Concept ObjectTransform">ObjectTransform</a> of the form
62                <code class="computeroutput">Object(A<sub>0</sub>,…A<sub>n</sub>)</code> or
63                <code class="computeroutput">Object(A<sub>0</sub>,…A<sub>n</sub> ...)</code>,
64                then let <code class="computeroutput">O</code> be the return type
65                <code class="computeroutput">Object</code>. Otherwise, let <code class="computeroutput">O</code>
66                be <code class="computeroutput">T</code>. The <code class="computeroutput">result_type</code> typedef is
67                then computed as follows:
68              </p>
69<p>
70                </p>
71<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
72<li class="listitem"><p>
73                      If <code class="computeroutput"><a class="link" href="../is_transform.html" title="Struct template is_transform">proto::is_transform</a>&lt;O&gt;::value</code> is
74                      <code class="computeroutput">true</code>, then let the result type be
75                      <code class="computeroutput">
76                        boost::result_of&lt;<a class="link" href="../when.html" title="Struct template when">proto::when</a>&lt;<a class="link" href="../_.html" title="Struct _">_</a>, O&gt;(Expr, State, Data)&gt;::type
77                      </code>.
78                      Note that a substitution took place.
79                    </p></li>
80<li class="listitem">
81                    If <code class="computeroutput">O</code> is a template like
82                    <code class="computeroutput"><a class="link" href="../noinvoke.html" title="Struct template noinvoke">proto::noinvoke</a>&lt;S&lt;X<sub>0</sub>,…X<sub>n</sub>&gt; &gt;</code>,
83                    then the result type is calculated as follows:
84                    <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
85<li class="listitem"><p>
86                          For each <code class="computeroutput">i</code> in
87                          <code class="computeroutput">[0,n]</code>, let <code class="computeroutput">
88                            X<sub>i</sub>'
89                          </code> be
90                          <code class="computeroutput">
91                            boost::result_of&lt;<a class="link" href="../make.html" title="Struct template make">proto::make</a>&lt;X<sub>i</sub>&gt;(Expr, State, Data)&gt;::type
92                          </code>
93                          (which evaluates this procedure recursively). Note that a substitution took place. (In this case,
94                          Proto merely assumes that a substitution took place for the sake of compile-time efficiency. There
95                          would be no reason to use <code class="computeroutput"><a class="link" href="../noinvoke.html" title="Struct template noinvoke">proto::noinvoke&lt;&gt;</a></code>
96                          otherwise.)
97                        </p></li>
98<li class="listitem"><p>
99                          The result type is
100                          <code class="computeroutput">
101                            S&lt;X<sub>0</sub>',…X<sub>n</sub>'&gt;
102                          </code>.
103                        </p></li>
104</ul></div>
105</li>
106<li class="listitem">
107                    If <code class="computeroutput">O</code> is a template like
108                    <code class="computeroutput">S&lt;X<sub>0</sub>,…X<sub>n</sub>&gt;</code>,
109                    then the result type is calculated as follows:
110                    <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
111<li class="listitem"><p>
112                          For each <code class="computeroutput">i</code> in
113                          <code class="computeroutput">[0,n]</code>, let <code class="computeroutput">
114                            X<sub>i</sub>'
115                          </code> be
116                          <code class="computeroutput">
117                            boost::result_of&lt;<a class="link" href="../make.html" title="Struct template make">proto::make</a>&lt;X<sub>i</sub>&gt;(Expr, State, Data)&gt;::type
118                          </code>
119                          (which evaluates this procedure recursively). Note whether any substitutions took place during
120                          this operation.
121                        </p></li>
122<li class="listitem"><p>
123                          If any substitutions took place in the above step and
124                          <code class="computeroutput">
125                            S&lt;X<sub>0</sub>',…X<sub>n</sub>'&gt;
126                          </code> has a nested
127                          <code class="computeroutput">type</code> typedef, the result type is
128                          <code class="computeroutput">
129                            S&lt;X<sub>0</sub>',…X<sub>n</sub>'&gt;::type
130                          </code>.
131                        </p></li>
132<li class="listitem"><p>
133                          Otherwise, the result type is
134                          <code class="computeroutput">
135                            S&lt;X<sub>0</sub>',…X<sub>n</sub>'&gt;
136                          </code>.
137                        </p></li>
138</ul></div>
139</li>
140<li class="listitem">
141                    Otherwise, the result type is <code class="computeroutput">O</code>, and note that no
142                    substitution took place.
143                  </li>
144</ul></div>
145<p>
146              </p>
147<p>
148                Note that <code class="computeroutput"><a class="link" href="../when.html" title="Struct template when">proto::when&lt;&gt;</a></code> is implemented
149                in terms of <code class="computeroutput"><a class="link" href="../call.html" title="Struct template call">proto::call&lt;&gt;</a></code>
150                and <code class="computeroutput"><a class="link" href="../make.html" title="Struct template make">proto::make&lt;&gt;</a></code>, so the
151                above procedure is evaluated recursively.
152              </p>
153</li></ol></div>
154</div>
155<div class="refsect2">
156<a name="id-1.3.33.5.52.6.4.4.4.3"></a><h3>
157<a name="id-1_3_33_5_50_2_1_3_5_4-bb"></a><code class="computeroutput">impl</code> public member functions</h3>
158<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
159<pre class="literallayout"><span class="identifier">result_type</span> <a name="id-1_3_33_5_50_2_1_3_5_4_1-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">typename</span> <span class="identifier">impl</span><span class="special">::</span><span class="identifier">expr_param</span> expr<span class="special">,</span>
160                       <span class="keyword">typename</span> <span class="identifier">impl</span><span class="special">::</span><span class="identifier">state_param</span> state<span class="special">,</span>
161                       <span class="keyword">typename</span> <span class="identifier">impl</span><span class="special">::</span><span class="identifier">data_param</span> data<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
162<p>
163                  <code class="computeroutput">
164                    <code class="computeroutput"><a class="link" href="../make.html" title="Struct template make">proto::make</a></code>&lt;T&gt;::impl&lt;Expr,State,Data&gt;::operator()
165                  </code>
166                  behaves as follows:
167                </p>
168<p>
169                  </p>
170<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
171<li class="listitem">
172<p>
173                        If <code class="computeroutput">T</code> is of the form
174                        <code class="computeroutput">O(A<sub>0</sub>,…A<sub>n</sub>)</code>, then:
175                      </p>
176<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
177<li class="listitem">
178<p>
179                            If <code class="computeroutput">
180                              <code class="computeroutput"><a class="link" href="../is_aggregate.html" title="Struct template is_aggregate">proto::is_aggregate</a></code>&lt;result_type&gt;::value
181                            </code> is <code class="computeroutput">true</code>, then construct
182                            and return an object <code class="computeroutput">that</code> as follows:
183                            </p>
184<pre class="programlisting">result_type that = {
185  <code class="computeroutput"><a class="link" href="../when.html" title="Struct template when">proto::when</a></code>&lt;<code class="computeroutput"><a class="link" href="../_.html" title="Struct _">_</a></code>, A<sub>0</sub>&gt;()(expr, state, data),
186187  <code class="computeroutput"><a class="link" href="../when.html" title="Struct template when">proto::when</a></code>&lt;<code class="computeroutput"><a class="link" href="../_.html" title="Struct _">_</a></code>, A<sub>n</sub>&gt;()(expr, state, data)
188};</pre>
189<p>
190                          </p>
191</li>
192<li class="listitem">
193<p>
194                            Otherwise, construct
195                            and return an object <code class="computeroutput">that</code> as follows:
196                            </p>
197<pre class="programlisting">result_type that(
198  <code class="computeroutput"><a class="link" href="../when.html" title="Struct template when">proto::when</a></code>&lt;<code class="computeroutput"><a class="link" href="../_.html" title="Struct _">_</a></code>, A<sub>0</sub>&gt;()(expr, state, data),
199200  <code class="computeroutput"><a class="link" href="../when.html" title="Struct template when">proto::when</a></code>&lt;<code class="computeroutput"><a class="link" href="../_.html" title="Struct _">_</a></code>, A<sub>n</sub>&gt;()(expr, state, data)
201);</pre>
202<p>
203                          </p>
204</li>
205</ul></div>
206</li>
207<li class="listitem">
208<p>
209                        If <code class="computeroutput">T</code> is of the form
210                        <code class="computeroutput">O(A<sub>0</sub>,…A<sub>n</sub> ...)</code>,
211                        then let <code class="computeroutput">T'</code> be <code class="computeroutput">O(A<sub>0</sub>,…A<sub>n-1</sub>, <em class="replaceable"><code>S</code></em>)</code>,
212                        where <em class="replaceable"><code>S</code></em> is a type sequence computed from the unpacking expression <code class="computeroutput">A<sub>n</sub></code>
213                        as described in the reference for <code class="computeroutput"><code class="computeroutput"><a class="link" href="../pack.html" title="Struct pack">proto::pack</a></code></code>. Then, return:
214                        </p>
215<pre class="programlisting">proto::make&lt;T'&gt;()(expr, state, data)</pre>
216<p>
217                      </p>
218</li>
219<li class="listitem">
220<p>
221                        Otherwise, construct and return an object <code class="computeroutput">that</code>
222                        as follows: </p>
223<pre class="programlisting">result_type that = result_type();</pre>
224<p>
225                      </p>
226</li>
227</ul></div>
228<p>
229                </p>
230</li></ol></div>
231</div>
232</div>
233</div>
234<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
235<td align="left"></td>
236<td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p>
237        Distributed under the Boost Software License, Version 1.0. (See accompanying
238        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
239      </p>
240</div></td>
241</tr></table>
242<hr>
243<div class="spirit-nav">
244<a accesskey="p" href="../make.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../make.html#id-1.3.33.5.52.6.4"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../pass_through.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
245</div>
246</body>
247</html>
248