1
<?xml version=
"1.0" encoding=
"utf-8"?>
3 Copyright 2012 Eric Niebler
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)
9 <header name=
"boost/proto/expr.hpp">
10 <namespace name=
"boost">
11 <namespace name=
"proto">
13 <!-- boost::proto::basic_expr -->
15 <struct name=
"basic_expr">
17 <template-type-parameter name=
"Tag"/>
18 <template-type-parameter name=
"Args"/>
19 <template-nontype-parameter name=
"Arity">
21 <default>Args::arity
</default>
22 </template-nontype-parameter>
25 <purpose>Simplified representation of a node in an expression tree.
</purpose>
29 <computeroutput>proto::basic_expr
<></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.
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
<></computeroutput> type represents a leaf in the
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
<></classname></computeroutput>,
45 <computeroutput><classname alt=
"proto::listN">proto::list2
<></classname></computeroutput>,
47 must all themselves be either
<computeroutput>proto::expr
<></computeroutput>
48 or
<computeroutput>proto::basic_expr
<>&</computeroutput> (or extensions thereof via
49 <computeroutput><classname>proto::extends
<></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
<T
></computeroutput>, where
54 <computeroutput>T
</computeroutput> can be any type.
57 <computeroutput>proto::basic_expr
<></computeroutput> is a valid Fusion
58 random-access sequence, where the elements of the sequence are the child
65 <typedef name=
"proto_tag">
69 <typedef name=
"proto_args">
73 <typedef name=
"proto_arity">
74 <type>mpl::long_
< Arity
></type>
77 <typedef name=
"proto_domain">
78 <type><classname>proto::basic_default_domain
</classname></type>
81 <typedef name=
"proto_grammar">
82 <type>basic_expr
</type>
85 <typedef name=
"proto_base_expr">
86 <type>basic_expr
</type>
89 <typedef name=
"proto_derived_expr">
90 <type>basic_expr
</type>
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>
98 <method-group name=
"public static functions">
101 <method name=
"make" specifiers=
"static">
102 <type>basic_expr const
</type>
104 <template-type-parameter name=
"A" pack=
"1"/>
106 <parameter name=
"a" pack=
"1">
107 <paramtype>A const
&</paramtype>
111 The number of supplied arguments must be
<computeroutput>max(Arity,
1)
</computeroutput>.
116 A new
<computeroutput>basic_expr
</computeroutput> object initialized with the specified arguments.
123 <method-group name=
"public member functions">
125 <method name=
"proto_base">
126 <type>basic_expr
&</type>
129 <computeroutput>*this
</computeroutput>
134 <method name=
"proto_base" cv=
"const">
135 <type>basic_expr const
&</type>
138 This is an overloaded member function, provided for convenience. It differs from
139 the above function only in what argument(s) it accepts.
147 <!-- boost::proto::expr -->
151 <template-type-parameter name=
"Tag"/>
152 <template-type-parameter name=
"Args"/>
153 <template-nontype-parameter name=
"Arity">
155 <default>Args::arity
</default>
156 </template-nontype-parameter>
159 <purpose>Representation of a node in an expression tree.
</purpose>
163 <computeroutput>proto::expr
<></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.
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
<></computeroutput> type represents a leaf in the
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
<></classname></computeroutput>,
179 <computeroutput><classname alt=
"proto::listN">proto::list2
<></classname></computeroutput>,
181 must all themselves be either
<computeroutput>proto::expr
<></computeroutput>
182 or
<computeroutput>proto::basic_expr
<>&</computeroutput> (or extensions thereof via
183 <computeroutput><classname>proto::extends
<></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
<T
></computeroutput>, where
188 <computeroutput>T
</computeroutput> can be any type.
191 <computeroutput>proto::expr
<></computeroutput> is a valid Fusion
192 random-access sequence, where the elements of the sequence are the child
199 <typedef name=
"proto_tag">
203 <typedef name=
"proto_args">
207 <typedef name=
"proto_arity">
208 <type>mpl::long_
< Arity
></type>
211 <typedef name=
"proto_domain">
212 <type><classname>proto::default_domain
</classname></type>
215 <typedef name=
"proto_grammar">
216 <type><classname>proto::basic_expr
</classname>< Tag, Args, Arity
></type>
219 <typedef name=
"proto_base_expr">
223 <typedef name=
"proto_derived_expr">
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>
232 <struct name=
"result">
234 <template-type-parameter name=
"Signature"/>
238 Encodes the return type of
<computeroutput><classname>proto::expr
<></classname>::operator()
</computeroutput>.
239 Makes
<computeroutput><classname>proto::expr
<></classname></computeroutput> a TR1-style function object type
240 usable with
<computeroutput>boost::result_of
<></computeroutput>
243 <typedef name=
"type">
244 <type><replaceable>unspecified
</replaceable></type>
248 <method-group name=
"public static functions">
251 <method name=
"make" specifiers=
"static">
252 <type>expr const
</type>
254 <template-type-parameter name=
"A" pack=
"1"/>
256 <parameter name=
"a" pack=
"1">
257 <paramtype>A const
&</paramtype>
261 The number of supplied arguments must be
<computeroutput>max(Arity,
1)
</computeroutput>.
266 A new
<computeroutput>expr
</computeroutput> object initialized with the specified arguments.
273 <method-group name=
"public member functions">
275 <method name=
"proto_base">
276 <type>expr
&</type>
277 <returns><para><computeroutput>*this
</computeroutput></para></returns>
280 <method name=
"proto_base" cv=
"const">
281 <type>expr const
&</type>
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>
289 <method name=
"operator=">
290 <type><replaceable>unspecified
</replaceable></type>
292 <template-type-parameter name=
"A"/>
295 <paramtype>A
&</paramtype>
298 <para>Lazy assignment expression
</para>
301 <para>A new expression node representing the assignment operation.
</para>
305 <method name=
"operator=">
306 <type><replaceable>unspecified
</replaceable></type>
308 <template-type-parameter name=
"A"/>
311 <paramtype>A const
&</paramtype>
315 This is an overloaded member function, provided for convenience. It differs from
316 the above function only in what argument(s) it accepts.
321 <method name=
"operator=" cv=
"const">
322 <type><replaceable>unspecified
</replaceable></type>
324 <template-type-parameter name=
"A"/>
327 <paramtype>A
&</paramtype>
331 This is an overloaded member function, provided for convenience. It differs from
332 the above function only in what argument(s) it accepts.
337 <method name=
"operator=" cv=
"const">
338 <type><replaceable>unspecified
</replaceable></type>
340 <template-type-parameter name=
"A"/>
343 <paramtype>A const
&</paramtype>
347 This is an overloaded member function, provided for convenience. It differs from
348 the above function only in what argument(s) it accepts.
354 <method name=
"operator[]">
355 <type><replaceable>unspecified
</replaceable></type>
357 <template-type-parameter name=
"A"/>
360 <paramtype>A
&</paramtype>
363 <para>Lazy subscript expression
</para>
366 <para>A new expression node representing the subscript operation.
</para>
370 <method name=
"operator[]">
371 <type><replaceable>unspecified
</replaceable></type>
373 <template-type-parameter name=
"A"/>
376 <paramtype>A const
&</paramtype>
380 This is an overloaded member function, provided for convenience. It differs from
381 the above function only in what argument(s) it accepts.
386 <method name=
"operator[]" cv=
"const">
387 <type><replaceable>unspecified
</replaceable></type>
389 <template-type-parameter name=
"A"/>
392 <paramtype>A
&</paramtype>
396 This is an overloaded member function, provided for convenience. It differs from
397 the above function only in what argument(s) it accepts.
402 <method name=
"operator[]" cv=
"const">
403 <type><replaceable>unspecified
</replaceable></type>
405 <template-type-parameter name=
"A"/>
408 <paramtype>A const
&</paramtype>
412 This is an overloaded member function, provided for convenience. It differs from
413 the above function only in what argument(s) it accepts.
419 <method name=
"operator()">
420 <type><replaceable>unspecified
</replaceable></type>
422 <template-type-parameter name=
"A" pack=
"1"/>
424 <parameter name=
"a" pack=
"1">
425 <paramtype>A const
&</paramtype>
428 <para>Lazy function call
</para>
431 <para>A new expression node representing the function call operation.
</para>
435 <method name=
"operator()" cv=
"const">
436 <type><replaceable>unspecified
</replaceable></type>
438 <template-type-parameter name=
"A" pack=
"1"/>
440 <parameter name=
"a" pack=
"1">
441 <paramtype>A const
&</paramtype>
445 This is an overloaded member function, provided for convenience. It differs from
446 the above function only in what argument(s) it accepts.
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>
458 <data-member name=
"proto_arity_c" specifiers=
"static">
459 <type>const long
</type>
461 <computeroutput>= Arity;
</computeroutput>
467 <!-- proto::unexpr -->
468 <struct name=
"unexpr">
470 <template-type-parameter name=
"Expr"/>
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"/>
477 <parameter name=
"expr">
478 <paramtype>Expr const
&</paramtype>
483 For an expression type
<computeroutput>E
</computeroutput>,
485 <classname>proto::is_expr
</classname><E
>::value
486 </computeroutput> is
<computeroutput>true
</computeroutput>, but
488 <classname>proto::is_expr
</classname><proto::unexpr
<E
> >::value
489 </computeroutput> is
<computeroutput>false
</computeroutput>.