1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Struct template default_eval</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../../proto/reference.html#header.boost.proto.context.default_hpp" title="Header <boost/proto/context/default.hpp>">
<link rel="prev" href="callable_context/eval.html" title="Struct template eval">
<link rel="next" href="default_context.html" title="Struct default_context">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="callable_context/eval.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../proto/reference.html#header.boost.proto.context.default_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="default_context.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.proto.context.default_eval"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct template default_eval</span></h2>
<p>boost::proto::context::default_eval —
A BinaryFunction that accepts a Proto expression and a context, evaluates
each child expression with the context, and combines the result using the
standard C++ meaning for the operator represented by the current expression
node.
</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../../proto/reference.html#header.boost.proto.context.default_hpp" title="Header <boost/proto/context/default.hpp>">boost/proto/context/default.hpp</a>>
</span><span class="keyword">template</span><span class="special"><</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> Context<span class="special">></span>
<span class="keyword">struct</span> <a class="link" href="default_eval.html" title="Struct template default_eval">default_eval</a> <span class="special">{</span>
<span class="comment">// <a class="link" href="default_eval.html#boost.proto.context.default_evaltypes">types</a></span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Expr</span><span class="special">::</span><span class="identifier">tag_type</span> <a name="boost.proto.context.default_eval.Tag"></a><span class="identifier">Tag</span><span class="special">;</span> <span class="comment">// For exposition only</span>
<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="default_eval.html#boost.proto.context.default_eval.result_type"><span class="identifier">result_type</span></a><span class="special">;</span>
<span class="comment">// <a class="link" href="default_eval.html#idp69104776-bb">public member functions</a></span>
<span class="identifier">result_type</span> <a class="link" href="default_eval.html#idp69105064-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">Expr</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">Context</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="comment">// public data members</span>
<span class="keyword">static</span> <span class="identifier">Expr</span> <span class="special">&</span> <span class="identifier">s_expr</span><span class="special">;</span> <span class="comment">// For exposition only</span>
<span class="keyword">static</span> <span class="identifier">Context</span> <span class="special">&</span> <span class="identifier">s_context</span><span class="special">;</span> <span class="comment">// For exposition only</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp188592248"></a><h2>Description</h2>
<p>
Let <code class="computeroutput"><code class="computeroutput">OP</code></code> be the C++ operator
corresponding to <code class="computeroutput">Expr::proto_tag</code>. (For example, if
<code class="computeroutput">Tag</code> is <code class="computeroutput">
<a class="link" href="../tag/plus.html" title="Struct plus">proto::tag::plus</a></code>, let <code class="computeroutput">
<code class="computeroutput">OP</code></code> be <code class="computeroutput">+</code>.)
</p>
<p>
The behavior of this class is specified in terms of the C++0x <code class="computeroutput">decltype</code>
keyword. In systems where this keyword is not available, Proto uses the Boost.Typeof library to
approximate the behavior.
</p>
<div class="refsect2">
<a name="idp188596472"></a><h3>
<a name="boost.proto.context.default_evaltypes"></a><code class="computeroutput">default_eval</code>
public
types</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>
<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.context.default_eval.result_type"></a><span class="identifier">result_type</span><span class="special">;</span></p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> corresponds to a unary prefix operator,
then the result type is
</p>
<pre class="programlisting"><span class="keyword">decltype</span><span class="special">(</span>
<span class="identifier">OP</span> <a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_idp68188920.html" title="Function child">proto::child</a><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span>
<span class="special">)</span></pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> corresponds to a unary postfix operator,
then the result type is
</p>
<pre class="programlisting"><span class="keyword">decltype</span><span class="special">(</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_idp68188920.html" title="Function child">proto::child</a><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="identifier">OP</span>
<span class="special">)</span></pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> corresponds to a binary infix operator,
then the result type is
</p>
<pre class="programlisting"><span class="keyword">decltype</span><span class="special">(</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../left_idp68289688.html" title="Function left">proto::left</a><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="identifier">OP</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../right_idp68332648.html" title="Function right">proto::right</a><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span>
<span class="special">)</span></pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> is <code class="computeroutput">
<a class="link" href="../tag/subscript.html" title="Struct subscript">proto::tag::subscript</a>
</code>,
then the result type is
</p>
<pre class="programlisting"><span class="keyword">decltype</span><span class="special">(</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../left_idp68289688.html" title="Function left">proto::left</a><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="special">[</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../right_idp68332648.html" title="Function right">proto::right</a><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="special">]</span>
<span class="special">)</span></pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> is <code class="computeroutput">
<a class="link" href="../tag/if_else_.html" title="Struct if_else_">proto::tag::if_else_</a>
</code>,
then the result type is
</p>
<pre class="programlisting"><span class="keyword">decltype</span><span class="special">(</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a><span class="special"><</span><span class="number">0</span><span class="special">></span><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="special">?</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a><span class="special"><</span><span class="number">1</span><span class="special">></span><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="special">:</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a><span class="special"><</span><span class="number">2</span><span class="special">></span><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span>
<span class="special">)</span></pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> is <code class="computeroutput">
<a class="link" href="../tag/function.html" title="Struct function">proto::tag::function</a>
</code>,
then the result type is
</p>
<pre class="programlisting"><span class="keyword">decltype</span><span class="special">(</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a><span class="special"><</span><span class="number">0</span><span class="special">></span><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="special">(</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a><span class="special"><</span><span class="number">1</span><span class="special">></span><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span><span class="special">,</span>
<span class="special">...</span>
<a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a><span class="special">(</span><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a><span class="special"><</span><span class="identifier">N</span><span class="special">></span><span class="special">(</span><span class="identifier">s_expr</span><span class="special">)</span><span class="special">,</span> <span class="identifier">s_context</span><span class="special">)</span> <span class="special">)</span>
<span class="special">)</span></pre>
<p>
</p>
</li>
</ul></div>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idp188654648"></a><h3>
<a name="idp69104776-bb"></a><code class="computeroutput">default_eval</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="identifier">result_type</span> <a name="idp69105064-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">Expr</span> <span class="special">&</span> expr<span class="special">,</span> <span class="identifier">Context</span> <span class="special">&</span> context<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> corresponds to a unary prefix operator,
then return
</p>
<pre class="programlisting">OP <code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_idp68188920.html" title="Function child">proto::child</a></code>(expr), context)</pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> corresponds to a unary postfix operator,
then return
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_idp68188920.html" title="Function child">proto::child</a></code>(expr), context) OP</pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> corresponds to a binary infix operator,
then return
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../left_idp68289688.html" title="Function left">proto::left</a></code>(expr), context) OP
<code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../right_idp68332648.html" title="Function right">proto::right</a></code>(expr), context)</pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> is <code class="computeroutput">
<code class="computeroutput"><a class="link" href="../tag/subscript.html" title="Struct subscript">proto::tag::subscript</a></code>
</code>,
then return
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../left_idp68289688.html" title="Function left">proto::left</a></code>(expr), context) [
<code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../right_idp68332648.html" title="Function right">proto::right</a></code>(expr), context) ]</pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> is <code class="computeroutput">
<code class="computeroutput"><a class="link" href="../tag/if_else_.html" title="Struct if_else_">proto::tag::if_else_</a></code>
</code>,
then return
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a></code><0>(expr), context) ?
<code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a></code><1>(expr), context) :
<code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a></code><2>(expr), context)</pre>
<p>
</p>
</li>
<li class="listitem">
<p>
If <code class="computeroutput">Tag</code> is <code class="computeroutput">
<code class="computeroutput"><a class="link" href="../tag/function.html" title="Struct function">proto::tag::function</a></code>
</code>,
then return
</p>
<pre class="programlisting"><code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a></code><0>(expr), context) (
<code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a></code><1>(expr), context),
...
<code class="computeroutput"><a class="link" href="../eval_idp66311848.html" title="Function eval">proto::eval</a></code>(<code class="computeroutput"><a class="link" href="../child_c_idp68301400.html" title="Function child_c">proto::child_c</a></code><N>(expr), context) )</pre>
<p>
</p>
</li>
</ul></div>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">context</code></span></p></td>
<td><p>The evaluation context </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">expr</code></span></p></td>
<td><p>The current expression </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li></ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008 Eric Niebler<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="callable_context/eval.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../proto/reference.html#header.boost.proto.context.default_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="default_context.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|