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>Concept 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" title="Reference"> 10<link rel="prev" href="Domain.html" title="Concept Domain"> 11<link rel="next" href="ObjectTransform.html" title="Concept ObjectTransform"> 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="Domain.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="proto/reference.html"><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="ObjectTransform.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="refentry"> 27<a name="Expr"></a><div class="titlepage"></div> 28<div class="refnamediv"> 29<h2><span class="refentrytitle">Concept Expr</span></h2> 30<p>Expr</p> 31</div> 32<div class="refsect1"> 33<a name="id-1.3.33.5.61.3"></a><h2>Description</h2> 34<p> 35 An Expr represents a tagged node in an expression tree. 36 The children of the Expr must themselves satisfy the 37 Expr concept. The Expr has an arity representing the 38 number of children. If the number of children is zero, 39 the Expr also has a value. An Expr also has an associated 40 <a class="link" href="Domain.html" title="Concept Domain">Domain</a>. 41 </p> 42</div> 43<div class="refsect1"> 44<a name="id-1.3.33.5.61.4"></a><h2>Associated types</h2> 45<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 46<li class="listitem"> 47<p><span class="bold"><strong>proto_tag</strong></span></p> 48<pre class="literallayout">Expr::proto_tag</pre> 49<p> 50 </p> 51<p>The tag type of the Expr.</p> 52<p> 53 </p> 54</li> 55<li class="listitem"> 56<p><span class="bold"><strong>proto_args</strong></span></p> 57<pre class="literallayout">Expr::proto_args</pre> 58<p> 59 </p> 60<p>A typelist representing either the types of the child nodes, or, 61 if the arity of the Expr is 0, of the value of the terminal.</p> 62<p> 63 </p> 64</li> 65<li class="listitem"> 66<p><span class="bold"><strong>proto_arity</strong></span></p> 67<pre class="literallayout">Expr::proto_arity</pre> 68<p> 69 </p> 70<p> 71 The arity (number of child nodes) of the Expr. 72 <code class="computeroutput">proto_arity</code> is an MPL Integral Constant. 73 </p> 74<p> 75 </p> 76</li> 77<li class="listitem"> 78<p><span class="bold"><strong>proto_grammar</strong></span></p> 79<pre class="literallayout">Expr::proto_grammar</pre> 80<p> 81 </p> 82<p> 83 A typedef for an instantiation of 84 <code class="computeroutput"><a class="link" href="boost/proto/basic_expr.html" title="Struct template basic_expr"> 85 proto::basic_expr<> 86 </a></code> 87 that is equivalent to Expr. Expression types are equivalent if they have the 88 same <code class="computeroutput">proto_tag</code>, <code class="computeroutput">proto_args</code>, and <code class="computeroutput">proto_arity</code>. 89 </p> 90<p> 91 </p> 92</li> 93<li class="listitem"> 94<p><span class="bold"><strong>proto_base_expr</strong></span></p> 95<pre class="literallayout">Expr::proto_base_expr</pre> 96<p> 97 </p> 98<p> 99 A typedef for an instantiation of 100 <code class="computeroutput"><a class="link" href="boost/proto/expr.html" title="Struct template expr">proto::expr<></a></code> or 101 <code class="computeroutput"><a class="link" href="boost/proto/basic_expr.html" title="Struct template basic_expr">proto::basic_expr<></a></code> 102 that is equivalent to Expr. Expression types are equivalent if they have the 103 same <code class="computeroutput">proto_tag</code>, <code class="computeroutput">proto_args</code>, and <code class="computeroutput">proto_arity</code>. 104 </p> 105<p> 106 </p> 107</li> 108<li class="listitem"> 109<p><span class="bold"><strong>proto_derived_expr</strong></span></p> 110<pre class="literallayout">Expr::proto_derived_expr</pre> 111<p> 112 </p> 113<p> 114 A typedef for <code class="computeroutput">Expr</code>. 115 </p> 116<p> 117 </p> 118</li> 119<li class="listitem"> 120<p><span class="bold"><strong>proto_domain</strong></span></p> 121<pre class="literallayout">Expr::proto_domain</pre> 122<p> 123 </p> 124<p> 125 The Domain of the Expr. <code class="computeroutput">proto_domain</code> 126 models <a class="link" href="Domain.html" title="Concept Domain">Domain</a>. 127 </p> 128<p> 129 </p> 130</li> 131<li class="listitem"> 132<p><span class="bold"><strong>proto_childN</strong></span></p> 133<pre class="literallayout">Expr::proto_childN</pre> 134<p> 135 </p> 136<p>The type of the Nth child of Expr. Requires 137 <code class="computeroutput">0 == N::value || N::value < proto_arity::value</code></p> 138<p> 139 </p> 140</li> 141</ul></div> 142</div> 143<div class="refsect1"> 144<a name="id-1.3.33.5.61.5"></a><h2>Notation</h2> 145<div class="variablelist"><dl class="variablelist"> 146<dt><span class="term">Expr</span></dt> 147<dd>A type playing the role of expession-type in the <a class="link" href="Expr.html" title="Concept Expr">Expr</a> concept.</dd> 148<dt><span class="term">Tag</span></dt> 149<dd>A type playing the role of tag-type in the <a class="link" href="Expr.html" title="Concept Expr">Expr</a> concept.</dd> 150<dt><span class="term">Domain</span></dt> 151<dd>A type playing the role of domain-type in the <a class="link" href="Expr.html" title="Concept Expr">Expr</a> concept.</dd> 152<dt><span class="term">N</span></dt> 153<dd>A type playing the role of mpl-integral-constant-type in the <a class="link" href="Expr.html" title="Concept Expr">Expr</a> concept.</dd> 154<dt><span class="term"><code class="varname">e</code></span></dt> 155<dd>Object of type Expr</dd> 156</dl></div> 157</div> 158<div class="refsect1"> 159<a name="id-1.3.33.5.61.6"></a><h2>Valid expressions</h2> 160<div class="informaltable"><table class="table"> 161<colgroup> 162<col> 163<col> 164<col> 165<col> 166</colgroup> 167<thead><tr> 168<th>Name</th> 169<th>Expression</th> 170<th>Type</th> 171<th>Semantics</th> 172</tr></thead> 173<tbody> 174<tr> 175<td><p>Get N-th Child</p></td> 176<td><p>boost::proto::child< N >(e)</p></td> 177<td><p><span class="type">proto_childN</span></p></td> 178<td><p>Extracts the Nth child from this Expr. 179 Requires <code class="computeroutput">N::value < proto_arity::value</code>.</p></td> 180</tr> 181<tr> 182<td><p>Get Terminal Value</p></td> 183<td><p>boost::proto::value(e)</p></td> 184<td><p><span class="type">proto_child0</span></p></td> 185<td><p> 186 Extracts the value from a terminal Expr. 187 Requires <code class="computeroutput">0 == proto_arity::value</code>. 188 </p></td> 189</tr> 190<tr> 191<td><p>Get Base</p></td> 192<td><p>e.proto_base()</p></td> 193<td><p><span class="type">proto_base_expr</span></p></td> 194<td><p> 195 Returns an object of type 196 <code class="computeroutput"><a class="link" href="boost/proto/expr.html" title="Struct template expr">proto::expr<></a></code> or 197 <code class="computeroutput"><a class="link" href="boost/proto/basic_expr.html" title="Struct template basic_expr">proto::basic_expr<></a></code> 198 that is equivalent to <code class="computeroutput">e</code>. 199 </p></td> 200</tr> 201</tbody> 202</table></div> 203</div> 204<div class="refsect1"> 205<a name="id-1.3.33.5.61.7"></a><h2>Models</h2> 206<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="simplelist"><span class="type">boost::proto::literal< int ></span></span></li></ul></div> 207</div> 208</div> 209<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 210<td align="left"></td> 211<td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p> 212 Distributed under the Boost Software License, Version 1.0. (See accompanying 213 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>) 214 </p> 215</div></td> 216</tr></table> 217<hr> 218<div class="spirit-nav"> 219<a accesskey="p" href="Domain.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="proto/reference.html"><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="ObjectTransform.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 220</div> 221</body> 222</html> 223