• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/expr.hpp">
10  <namespace name="boost">
11    <namespace name="proto">
12
13      <!-- boost::proto::basic_expr -->
14
15      <struct name="basic_expr">
16        <template>
17          <template-type-parameter name="Tag"/>
18          <template-type-parameter name="Args"/>
19          <template-nontype-parameter name="Arity">
20            <type>long</type>
21            <default>Args::arity</default>
22          </template-nontype-parameter>
23        </template>
24
25        <purpose>Simplified representation of a node in an expression tree.</purpose>
26
27        <description>
28          <para>
29            <computeroutput>proto::basic_expr&lt;&gt;</computeroutput> is a node in an expression
30            template tree. It is a container for its child sub-trees. It also serves as the
31            terminal nodes of the tree.
32          </para>
33          <para>
34            <computeroutput>Tag</computeroutput> is type that represents the operation
35            encoded by this expression. It is typically one of the structs in the
36            <computeroutput>boost::proto::tag</computeroutput> namespace, but it doesn't
37            have to be. If <computeroutput>Arity</computeroutput> is 0 then this
38            <computeroutput>expr&lt;&gt;</computeroutput> type represents a leaf in the
39            expression tree.
40          </para>
41          <para>
42            <computeroutput>Args</computeroutput> is a list of types representing
43            the children of this expression. It is an instantiation of one of
44            <computeroutput><classname alt="proto::listN">proto::list1&lt;&gt;</classname></computeroutput>,
45            <computeroutput><classname alt="proto::listN">proto::list2&lt;&gt;</classname></computeroutput>,
46            etc. The child types
47            must all themselves be either <computeroutput>proto::expr&lt;&gt;</computeroutput>
48            or <computeroutput>proto::basic_expr&lt;&gt;&amp;</computeroutput> (or extensions thereof via
49            <computeroutput><classname>proto::extends&lt;&gt;</classname></computeroutput> or
50            <computeroutput><macroname>BOOST_PROTO_EXTENDS</macroname>()</computeroutput>), unless
51            <computeroutput>Arity</computeroutput> is 0, in which case
52            <computeroutput>Args</computeroutput> must be
53            <computeroutput>proto::term&lt;T&gt;</computeroutput>, where
54            <computeroutput>T</computeroutput> can be any type.
55          </para>
56          <para>
57            <computeroutput>proto::basic_expr&lt;&gt;</computeroutput> is a valid Fusion
58            random-access sequence, where the elements of the sequence are the child
59            expressions.
60          </para>
61        </description>
62
63        <!-- typedefs -->
64
65        <typedef name="proto_tag">
66          <type>Tag</type>
67        </typedef>
68
69        <typedef name="proto_args">
70          <type>Args</type>
71        </typedef>
72
73        <typedef name="proto_arity">
74          <type>mpl::long_&lt; Arity &gt;</type>
75        </typedef>
76
77        <typedef name="proto_domain">
78          <type><classname>proto::basic_default_domain</classname></type>
79        </typedef>
80
81        <typedef name="proto_grammar">
82          <type>basic_expr</type>
83        </typedef>
84
85        <typedef name="proto_base_expr">
86          <type>basic_expr</type>
87        </typedef>
88
89        <typedef name="proto_derived_expr">
90          <type>basic_expr</type>
91        </typedef>
92
93        <typedef name="proto_childN">
94          <type>typename Args::child<replaceable>N</replaceable></type>
95          <purpose>For each <replaceable>N</replaceable> in <replaceable>[0,max(Arity,1))</replaceable>.</purpose>
96        </typedef>
97
98        <method-group name="public static functions">
99
100          <!-- make -->
101          <method name="make" specifiers="static">
102            <type>basic_expr const</type>
103            <template>
104              <template-type-parameter name="A" pack="1"/>
105            </template>
106            <parameter name="a" pack="1">
107              <paramtype>A const &amp;</paramtype>
108            </parameter>
109            <requires>
110              <para>
111                The number of supplied arguments must be <computeroutput>max(Arity,1)</computeroutput>.
112              </para>
113            </requires>
114            <returns>
115              <para>
116                A new <computeroutput>basic_expr</computeroutput> object initialized with the specified arguments.
117              </para>
118            </returns>
119          </method>
120
121        </method-group>
122
123        <method-group name="public member functions">
124
125          <method name="proto_base">
126            <type>basic_expr &amp;</type>
127            <returns>
128              <para>
129                <computeroutput>*this</computeroutput>
130              </para>
131            </returns>
132          </method>
133
134          <method name="proto_base" cv="const">
135            <type>basic_expr const &amp;</type>
136            <description>
137              <para>
138                This is an overloaded member function, provided for convenience. It differs from
139                the above function only in what argument(s) it accepts.
140              </para>
141            </description>
142          </method>
143
144        </method-group>
145      </struct>
146
147      <!-- boost::proto::expr -->
148
149      <struct name="expr">
150        <template>
151          <template-type-parameter name="Tag"/>
152          <template-type-parameter name="Args"/>
153          <template-nontype-parameter name="Arity">
154            <type>long</type>
155            <default>Args::arity</default>
156          </template-nontype-parameter>
157        </template>
158
159        <purpose>Representation of a node in an expression tree.</purpose>
160
161        <description>
162          <para>
163            <computeroutput>proto::expr&lt;&gt;</computeroutput> is a node in an expression
164            template tree. It is a container for its child sub-trees. It also serves as the
165            terminal nodes of the tree.
166          </para>
167          <para>
168            <computeroutput>Tag</computeroutput> is type that represents the operation
169            encoded by this expression. It is typically one of the structs in the
170            <computeroutput>boost::proto::tag</computeroutput> namespace, but it doesn't
171            have to be. If <computeroutput>Arity</computeroutput> is 0 then this
172            <computeroutput>expr&lt;&gt;</computeroutput> type represents a leaf in the
173            expression tree.
174          </para>
175          <para>
176            <computeroutput>Args</computeroutput> is a list of types representing
177            the children of this expression. It is an instantiation of one of
178            <computeroutput><classname alt="proto::listN">proto::list1&lt;&gt;</classname></computeroutput>,
179            <computeroutput><classname alt="proto::listN">proto::list2&lt;&gt;</classname></computeroutput>,
180            etc. The child types
181            must all themselves be either <computeroutput>proto::expr&lt;&gt;</computeroutput>
182            or <computeroutput>proto::basic_expr&lt;&gt;&amp;</computeroutput> (or extensions thereof via
183            <computeroutput><classname>proto::extends&lt;&gt;</classname></computeroutput> or
184            <computeroutput><macroname>BOOST_PROTO_EXTENDS</macroname>()</computeroutput>), unless
185            <computeroutput>Arity</computeroutput> is 0, in which case
186            <computeroutput>Args</computeroutput> must be
187            <computeroutput>proto::term&lt;T&gt;</computeroutput>, where
188            <computeroutput>T</computeroutput> can be any type.
189          </para>
190          <para>
191            <computeroutput>proto::expr&lt;&gt;</computeroutput> is a valid Fusion
192            random-access sequence, where the elements of the sequence are the child
193            expressions.
194          </para>
195        </description>
196
197        <!-- typedefs -->
198
199        <typedef name="proto_tag">
200          <type>Tag</type>
201        </typedef>
202
203        <typedef name="proto_args">
204          <type>Args</type>
205        </typedef>
206
207        <typedef name="proto_arity">
208          <type>mpl::long_&lt; Arity &gt;</type>
209        </typedef>
210
211        <typedef name="proto_domain">
212          <type><classname>proto::default_domain</classname></type>
213        </typedef>
214
215        <typedef name="proto_grammar">
216          <type><classname>proto::basic_expr</classname>&lt; Tag, Args, Arity &gt;</type>
217        </typedef>
218
219        <typedef name="proto_base_expr">
220          <type>expr</type>
221        </typedef>
222
223        <typedef name="proto_derived_expr">
224          <type>expr</type>
225        </typedef>
226
227        <typedef name="proto_childN">
228          <type>typename Args::child<replaceable>N</replaceable></type>
229          <purpose>For each <replaceable>N</replaceable> in <replaceable>[0,max(Arity,1))</replaceable>.</purpose>
230        </typedef>
231
232        <struct name="result">
233          <template>
234            <template-type-parameter name="Signature"/>
235          </template>
236          <description>
237            <para>
238              Encodes the return type of <computeroutput><classname>proto::expr&lt;&gt;</classname>::operator()</computeroutput>.
239              Makes <computeroutput><classname>proto::expr&lt;&gt;</classname></computeroutput> a TR1-style function object type
240              usable with <computeroutput>boost::result_of&lt;&gt;</computeroutput>
241            </para>
242          </description>
243          <typedef name="type">
244            <type><replaceable>unspecified</replaceable></type>
245          </typedef>
246        </struct>
247
248        <method-group name="public static functions">
249
250          <!-- make -->
251          <method name="make" specifiers="static">
252            <type>expr const</type>
253            <template>
254              <template-type-parameter name="A" pack="1"/>
255            </template>
256            <parameter name="a" pack="1">
257              <paramtype>A const &amp;</paramtype>
258            </parameter>
259            <requires>
260              <para>
261                The number of supplied arguments must be <computeroutput>max(Arity,1)</computeroutput>.
262              </para>
263            </requires>
264            <returns>
265              <para>
266                A new <computeroutput>expr</computeroutput> object initialized with the specified arguments.
267              </para>
268            </returns>
269          </method>
270
271        </method-group>
272
273        <method-group name="public member functions">
274
275          <method name="proto_base">
276            <type>expr &amp;</type>
277            <returns><para><computeroutput>*this</computeroutput></para></returns>
278          </method>
279
280          <method name="proto_base" cv="const">
281            <type>expr const &amp;</type>
282            <description>
283              <para>This is an overloaded member function, provided for convenience. It differs from
284              the above function only in what argument(s) it accepts.</para>
285            </description>
286          </method>
287
288          <!-- operator= -->
289          <method name="operator=">
290            <type><replaceable>unspecified</replaceable></type>
291            <template>
292              <template-type-parameter name="A"/>
293            </template>
294            <parameter name="a">
295              <paramtype>A &amp;</paramtype>
296            </parameter>
297            <description>
298              <para>Lazy assignment expression</para>
299            </description>
300            <returns>
301              <para>A new expression node representing the assignment operation.</para>
302            </returns>
303          </method>
304
305          <method name="operator=">
306            <type><replaceable>unspecified</replaceable></type>
307            <template>
308              <template-type-parameter name="A"/>
309            </template>
310            <parameter name="a">
311              <paramtype>A const &amp;</paramtype>
312            </parameter>
313            <description>
314              <para>
315                This is an overloaded member function, provided for convenience. It differs from
316                the above function only in what argument(s) it accepts.
317              </para>
318            </description>
319          </method>
320
321          <method name="operator=" cv="const">
322            <type><replaceable>unspecified</replaceable></type>
323            <template>
324              <template-type-parameter name="A"/>
325            </template>
326            <parameter name="a">
327              <paramtype>A &amp;</paramtype>
328            </parameter>
329            <description>
330              <para>
331                This is an overloaded member function, provided for convenience. It differs from
332                the above function only in what argument(s) it accepts.
333              </para>
334            </description>
335          </method>
336
337          <method name="operator=" cv="const">
338            <type><replaceable>unspecified</replaceable></type>
339            <template>
340              <template-type-parameter name="A"/>
341            </template>
342            <parameter name="a">
343              <paramtype>A const &amp;</paramtype>
344            </parameter>
345            <description>
346              <para>
347                This is an overloaded member function, provided for convenience. It differs from
348                the above function only in what argument(s) it accepts.
349              </para>
350            </description>
351          </method>
352
353          <!-- operator[] -->
354          <method name="operator[]">
355            <type><replaceable>unspecified</replaceable></type>
356            <template>
357              <template-type-parameter name="A"/>
358            </template>
359            <parameter name="a">
360              <paramtype>A &amp;</paramtype>
361            </parameter>
362            <description>
363              <para>Lazy subscript expression</para>
364            </description>
365            <returns>
366              <para>A new expression node representing the subscript operation.</para>
367            </returns>
368          </method>
369
370          <method name="operator[]">
371            <type><replaceable>unspecified</replaceable></type>
372            <template>
373              <template-type-parameter name="A"/>
374            </template>
375            <parameter name="a">
376              <paramtype>A const &amp;</paramtype>
377            </parameter>
378            <description>
379              <para>
380                This is an overloaded member function, provided for convenience. It differs from
381                the above function only in what argument(s) it accepts.
382              </para>
383            </description>
384          </method>
385
386          <method name="operator[]" cv="const">
387            <type><replaceable>unspecified</replaceable></type>
388            <template>
389              <template-type-parameter name="A"/>
390            </template>
391            <parameter name="a">
392              <paramtype>A &amp;</paramtype>
393            </parameter>
394            <description>
395              <para>
396                This is an overloaded member function, provided for convenience. It differs from
397                the above function only in what argument(s) it accepts.
398              </para>
399            </description>
400          </method>
401
402          <method name="operator[]" cv="const">
403            <type><replaceable>unspecified</replaceable></type>
404            <template>
405              <template-type-parameter name="A"/>
406            </template>
407            <parameter name="a">
408              <paramtype>A const &amp;</paramtype>
409            </parameter>
410            <description>
411              <para>
412                This is an overloaded member function, provided for convenience. It differs from
413                the above function only in what argument(s) it accepts.
414              </para>
415            </description>
416          </method>
417
418          <!-- operator() -->
419          <method name="operator()">
420            <type><replaceable>unspecified</replaceable></type>
421            <template>
422              <template-type-parameter name="A" pack="1"/>
423            </template>
424            <parameter name="a" pack="1">
425              <paramtype>A const &amp;</paramtype>
426            </parameter>
427            <description>
428              <para>Lazy function call</para>
429            </description>
430            <returns>
431              <para>A new expression node representing the function call operation.</para>
432            </returns>
433          </method>
434
435          <method name="operator()" cv="const">
436            <type><replaceable>unspecified</replaceable></type>
437            <template>
438              <template-type-parameter name="A" pack="1"/>
439            </template>
440            <parameter name="a" pack="1">
441              <paramtype>A const &amp;</paramtype>
442            </parameter>
443            <description>
444              <para>
445                This is an overloaded member function, provided for convenience. It differs from
446                the above function only in what argument(s) it accepts.
447              </para>
448            </description>
449          </method>
450
451        </method-group>
452
453        <data-member name="childN">
454          <type>proto_child<replaceable>N</replaceable></type>
455          <purpose>For each <replaceable>N</replaceable> in <replaceable>[0,max(Arity,1))</replaceable>.</purpose>
456        </data-member>
457
458        <data-member name="proto_arity_c" specifiers="static">
459          <type>const long</type>
460          <purpose>
461            <computeroutput>= Arity;</computeroutput>
462          </purpose>
463        </data-member>
464
465      </struct>
466
467      <!-- proto::unexpr -->
468      <struct name="unexpr">
469        <template>
470          <template-type-parameter name="Expr"/>
471        </template>
472        <purpose>Lets you inherit the interface of an expression while hiding from Proto the fact that
473          the type is a Proto expression.</purpose>
474        <inherit><type>Expr</type></inherit>
475        <method-group name="public member functions"/>
476        <constructor>
477          <parameter name="expr">
478            <paramtype>Expr const &amp;</paramtype>
479          </parameter>
480        </constructor>
481        <description>
482          <para>
483            For an expression type <computeroutput>E</computeroutput>,
484            <computeroutput>
485              <classname>proto::is_expr</classname>&lt;E&gt;::value
486            </computeroutput> is <computeroutput>true</computeroutput>, but
487            <computeroutput>
488              <classname>proto::is_expr</classname>&lt;proto::unexpr&lt;E&gt; &gt;::value
489            </computeroutput> is <computeroutput>false</computeroutput>.
490          </para>
491        </description>
492      </struct>
493
494    </namespace>
495  </namespace>
496</header>
497