• 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 basic_expr</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="../../proto/reference.html#header.boost.proto.expr_hpp" title="Header &lt;boost/proto/expr.hpp&gt;">
10<link rel="prev" href="eval.html" title="Function eval">
11<link rel="next" href="expr.html" title="Struct template expr">
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="eval.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.expr_hpp"><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="expr.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.proto.basic_expr"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Struct template basic_expr</span></h2>
30<p>boost::proto::basic_expr — Simplified representation of a node in an expression tree.</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.expr_hpp" title="Header &lt;boost/proto/expr.hpp&gt;">boost/proto/expr.hpp</a>&gt;
34
35</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Tag<span class="special">,</span> <span class="keyword">typename</span> Args<span class="special">,</span> <span class="keyword">long</span> Arity <span class="special">=</span> <span class="identifier">Args</span><span class="special">::</span><span class="identifier">arity</span><span class="special">&gt;</span>
36<span class="keyword">struct</span> <a class="link" href="basic_expr.html" title="Struct template basic_expr">basic_expr</a> <span class="special">{</span>
37  <span class="comment">// types</span>
38  <span class="keyword">typedef</span> <span class="identifier">Tag</span>                         <a name="boost.proto.basic_expr.proto_tag"></a><span class="identifier">proto_tag</span><span class="special">;</span>
39  <span class="keyword">typedef</span> <span class="identifier">Args</span>                        <a name="boost.proto.basic_expr.proto_args"></a><span class="identifier">proto_args</span><span class="special">;</span>
40  <span class="keyword">typedef</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">long_</span><span class="special">&lt;</span> <span class="identifier">Arity</span> <span class="special">&gt;</span>         <a name="boost.proto.basic_expr.proto_arity"></a><span class="identifier">proto_arity</span><span class="special">;</span>
41  <span class="keyword">typedef</span> <a class="link" href="basic_default_domain.html" title="Struct basic_default_domain">proto::basic_default_domain</a> <a name="boost.proto.basic_expr.proto_domain"></a><span class="identifier">proto_domain</span><span class="special">;</span>
42  <span class="keyword">typedef</span> <span class="identifier">basic_expr</span>                  <a name="boost.proto.basic_expr.proto_grammar"></a><span class="identifier">proto_grammar</span><span class="special">;</span>
43  <span class="keyword">typedef</span> <span class="identifier">basic_expr</span>                  <a name="boost.proto.basic_expr.proto_base_expr"></a><span class="identifier">proto_base_expr</span><span class="special">;</span>
44  <span class="keyword">typedef</span> <span class="identifier">basic_expr</span>                  <a name="boost.proto.basic_expr.proto_derived_expr"></a><span class="identifier">proto_derived_expr</span><span class="special">;</span>
45  <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Args</span><span class="special">::</span><span class="identifier">child</span><em class="replaceable"><code><span class="identifier">N</span></code></em>       <a name="boost.proto.basic_expr.proto_childN"></a><span class="identifier">proto_childN</span><span class="special">;</span>        <span class="comment">// For each <em class="replaceable"><code>N</code></em> in <em class="replaceable"><code>[0,max(Arity,1))</code></em>.</span>
46
47  <span class="comment">// <a class="link" href="basic_expr.html#id-1_3_33_5_9_1_1_1_12-bb">public static functions</a></span>
48  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span><span class="special">...</span> A<span class="special">&gt;</span> <span class="keyword">static</span> <span class="identifier">basic_expr</span> <span class="keyword">const</span> <a class="link" href="basic_expr.html#id-1_3_33_5_9_1_1_1_12_1-bb"><span class="identifier">make</span></a><span class="special">(</span><span class="identifier">A</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
49
50  <span class="comment">// <a class="link" href="basic_expr.html#id-1_3_33_5_9_1_1_1_13-bb">public member functions</a></span>
51  <span class="identifier">basic_expr</span> <span class="special">&amp;</span> <a class="link" href="basic_expr.html#id-1_3_33_5_9_1_1_1_13_1-bb"><span class="identifier">proto_base</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
52  <span class="identifier">basic_expr</span> <span class="keyword">const</span> <span class="special">&amp;</span> <a class="link" href="basic_expr.html#id-1_3_33_5_9_1_1_1_13_2-bb"><span class="identifier">proto_base</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
53<span class="special">}</span><span class="special">;</span></pre></div>
54<div class="refsect1">
55<a name="id-1.3.33.5.11.3.4"></a><h2>Description</h2>
56<p>
57            <code class="computeroutput">proto::basic_expr&lt;&gt;</code> is a node in an expression
58            template tree. It is a container for its child sub-trees. It also serves as the
59            terminal nodes of the tree.
60          </p>
61<p>
62            <code class="computeroutput">Tag</code> is type that represents the operation
63            encoded by this expression. It is typically one of the structs in the
64            <code class="computeroutput">boost::proto::tag</code> namespace, but it doesn't
65            have to be. If <code class="computeroutput">Arity</code> is 0 then this
66            <code class="computeroutput">expr&lt;&gt;</code> type represents a leaf in the
67            expression tree.
68          </p>
69<p>
70            <code class="computeroutput">Args</code> is a list of types representing
71            the children of this expression. It is an instantiation of one of
72            <code class="computeroutput"><a class="link" href="listN.html" title="Struct template listN">proto::list1&lt;&gt;</a></code>,
73            <code class="computeroutput"><a class="link" href="listN.html" title="Struct template listN">proto::list2&lt;&gt;</a></code>,
74            etc. The child types
75            must all themselves be either <code class="computeroutput">proto::expr&lt;&gt;</code>
76            or <code class="computeroutput">proto::basic_expr&lt;&gt;&amp;</code> (or extensions thereof via
77            <code class="computeroutput"><a class="link" href="extends.html" title="Struct template extends">proto::extends&lt;&gt;</a></code> or
78            <code class="computeroutput"><a class="link" href="../../BOOST_PROTO_EXTENDS.html" title="Macro BOOST_PROTO_EXTENDS">BOOST_PROTO_EXTENDS</a>()</code>), unless
79            <code class="computeroutput">Arity</code> is 0, in which case
80            <code class="computeroutput">Args</code> must be
81            <code class="computeroutput">proto::term&lt;T&gt;</code>, where
82            <code class="computeroutput">T</code> can be any type.
83          </p>
84<p>
85            <code class="computeroutput">proto::basic_expr&lt;&gt;</code> is a valid Fusion
86            random-access sequence, where the elements of the sequence are the child
87            expressions.
88          </p>
89<div class="refsect2">
90<a name="id-1.3.33.5.11.3.4.6"></a><h3>
91<a name="id-1_3_33_5_9_1_1_1_12-bb"></a><code class="computeroutput">basic_expr</code> public static functions</h3>
92<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
93<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span><span class="special">...</span> A<span class="special">&gt;</span> <span class="keyword">static</span> <span class="identifier">basic_expr</span> <span class="keyword">const</span> <a name="id-1_3_33_5_9_1_1_1_12_1-bb"></a><span class="identifier">make</span><span class="special">(</span><span class="identifier">A</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">...</span> a<span class="special">)</span><span class="special">;</span></pre>
94<div class="variablelist"><table border="0" class="variablelist compact">
95<colgroup>
96<col align="left" valign="top">
97<col>
98</colgroup>
99<tbody>
100<tr>
101<td><p><span class="term">Requires:</span></p></td>
102<td><p>
103                The number of supplied arguments must be <code class="computeroutput">max(Arity,1)</code>.
104              </p></td>
105</tr>
106<tr>
107<td><p><span class="term">Returns:</span></p></td>
108<td><p>
109                A new <code class="computeroutput">basic_expr</code> object initialized with the specified arguments.
110              </p></td>
111</tr>
112</tbody>
113</table></div>
114</li></ol></div>
115</div>
116<div class="refsect2">
117<a name="id-1.3.33.5.11.3.4.7"></a><h3>
118<a name="id-1_3_33_5_9_1_1_1_13-bb"></a><code class="computeroutput">basic_expr</code> public member functions</h3>
119<div class="orderedlist"><ol class="orderedlist" type="1">
120<li class="listitem">
121<pre class="literallayout"><span class="identifier">basic_expr</span> <span class="special">&amp;</span> <a name="id-1_3_33_5_9_1_1_1_13_1-bb"></a><span class="identifier">proto_base</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
122<div class="variablelist"><table border="0" class="variablelist compact">
123<colgroup>
124<col align="left" valign="top">
125<col>
126</colgroup>
127<tbody><tr>
128<td><p><span class="term">Returns:</span></p></td>
129<td><p>
130                <code class="computeroutput">*this</code>
131              </p></td>
132</tr></tbody>
133</table></div>
134</li>
135<li class="listitem">
136<pre class="literallayout"><span class="identifier">basic_expr</span> <span class="keyword">const</span> <span class="special">&amp;</span> <a name="id-1_3_33_5_9_1_1_1_13_2-bb"></a><span class="identifier">proto_base</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
137<p>
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              </p>
141</li>
142</ol></div>
143</div>
144</div>
145</div>
146<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
147<td align="left"></td>
148<td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p>
149        Distributed under the Boost Software License, Version 1.0. (See accompanying
150        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>)
151      </p>
152</div></td>
153</tr></table>
154<hr>
155<div class="spirit-nav">
156<a accesskey="p" href="eval.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../proto/reference.html#header.boost.proto.expr_hpp"><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="expr.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
157</div>
158</body>
159</html>
160