PageRenderTime 17ms CodeModel.GetById 1ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/phoenix/doc/html/phoenix/modules/operator/supported_operators.html

http://hadesmem.googlecode.com/
HTML | 110 lines | 106 code | 4 blank | 0 comment | 0 complexity | 9a381f4ea50f89205a73225a1d9580e6 MD5 | raw file
  1<html>
  2<head>
  3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4<title>Supported operators</title>
  5<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
  6<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
  7<link rel="home" href="../../../index.html" title="Chapter&#160;1.&#160;Phoenix 3.0">
  8<link rel="up" href="../operator.html" title="Operator">
  9<link rel="prev" href="../operator.html" title="Operator">
 10</head>
 11<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 12<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
 13<hr>
 14<div class="spirit-nav">
 15<a accesskey="p" href="../operator.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../operator.html"><img src="../../../images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../images/home.png" alt="Home"></a>
 16</div>
 17<div class="section">
 18<div class="titlepage"><div><div><h4 class="title">
 19<a name="phoenix.modules.operator.supported_operators"></a><a class="link" href="supported_operators.html" title="Supported operators">Supported
 20        operators</a>
 21</h4></div></div></div>
 22<a name="phoenix.modules.operator.supported_operators.unary_operators"></a><h6>
 23<a name="id856596"></a>
 24          <a class="link" href="supported_operators.html#phoenix.modules.operator.supported_operators.unary_operators">Unary
 25          operators</a>
 26        </h6>
 27<pre class="programlisting"><span class="identifier">prefix</span><span class="special">:</span>   <span class="special">~,</span> <span class="special">!,</span> <span class="special">-,</span> <span class="special">+,</span> <span class="special">++,</span> <span class="special">--,</span> <span class="special">&amp;</span> <span class="special">(</span><span class="identifier">reference</span><span class="special">),</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">dereference</span><span class="special">)</span>
 28<span class="identifier">postfix</span><span class="special">:</span>  <span class="special">++,</span> <span class="special">--</span>
 29</pre>
 30<a name="phoenix.modules.operator.supported_operators.binary_operators"></a><h6>
 31<a name="id856727"></a>
 32          <a class="link" href="supported_operators.html#phoenix.modules.operator.supported_operators.binary_operators">Binary
 33          operators</a>
 34        </h6>
 35<pre class="programlisting"><span class="special">=,</span> <span class="special">[],</span> <span class="special">+=,</span> <span class="special">-=,</span> <span class="special">*=,</span> <span class="special">/=,</span> <span class="special">%=,</span> <span class="special">&amp;=,</span> <span class="special">|=,</span> <span class="special">^=,</span> <span class="special">&lt;&lt;=,</span> <span class="special">&gt;&gt;=</span>
 36<span class="special">+,</span> <span class="special">-,</span> <span class="special">*,</span> <span class="special">/,</span> <span class="special">%,</span> <span class="special">&amp;,</span> <span class="special">|,</span> <span class="special">^,</span> <span class="special">&lt;&lt;,</span> <span class="special">&gt;&gt;</span>
 37<span class="special">==,</span> <span class="special">!=,</span> <span class="special">&lt;,</span> <span class="special">&gt;,</span> <span class="special">&lt;=,</span> <span class="special">&gt;=</span>
 38<span class="special">&amp;&amp;,</span> <span class="special">||,</span> <span class="special">-&gt;*</span>
 39</pre>
 40<a name="phoenix.modules.operator.supported_operators.ternary_operator"></a><h6>
 41<a name="id856928"></a>
 42          <a class="link" href="supported_operators.html#phoenix.modules.operator.supported_operators.ternary_operator">Ternary
 43          operator</a>
 44        </h6>
 45<pre class="programlisting"><span class="identifier">if_else</span><span class="special">(</span><span class="identifier">c</span><span class="special">,</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span>
 46</pre>
 47<p>
 48          The ternary operator deserves special mention. Since C++ does not allow
 49          us to overload the conditional expression: <code class="computeroutput"><span class="identifier">c</span>
 50          <span class="special">?</span> <span class="identifier">a</span>
 51          <span class="special">:</span> <span class="identifier">b</span></code>,
 52          the if_else pseudo function is provided for this purpose. The behavior
 53          is identical, albeit in a lazy manner.
 54        </p>
 55<a name="phoenix.modules.operator.supported_operators.member_pointer_operator"></a><h6>
 56<a name="id857031"></a>
 57          <a class="link" href="supported_operators.html#phoenix.modules.operator.supported_operators.member_pointer_operator">Member
 58          pointer operator</a>
 59        </h6>
 60<pre class="programlisting"><span class="identifier">a</span><span class="special">-&gt;*</span><span class="identifier">member_object_pointer</span>
 61<span class="identifier">a</span><span class="special">-&gt;*</span><span class="identifier">member_function_pointer</span>
 62</pre>
 63<p>
 64          The left hand side of the member pointer operator must be an actor returning
 65          a pointer type. The right hand side of the member pointer operator may
 66          be either a pointer to member object or pointer to member function.
 67        </p>
 68<p>
 69          If the right hand side is a member object pointer, the result is an actor
 70          which, when evaluated, returns a reference to that member. For example:
 71        </p>
 72<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">A</span>
 73<span class="special">{</span>
 74    <span class="keyword">int</span> <span class="identifier">member</span><span class="special">;</span>
 75<span class="special">};</span>
 76
 77<span class="identifier">A</span><span class="special">*</span> <span class="identifier">a</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">A</span><span class="special">;</span>
 78<span class="special">...</span>
 79
 80<span class="special">(</span><span class="identifier">arg1</span><span class="special">-&gt;*&amp;</span><span class="identifier">A</span><span class="special">::</span><span class="identifier">member</span><span class="special">)(</span><span class="identifier">a</span><span class="special">);</span> <span class="comment">// returns member a-&gt;member
 81</span></pre>
 82<p>
 83          If the right hand side is a member function pointer, the result is an actor
 84          which, when invoked, calls the specified member function. For example:
 85        </p>
 86<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">A</span>
 87<span class="special">{</span>
 88    <span class="keyword">int</span> <span class="identifier">func</span><span class="special">(</span><span class="keyword">int</span><span class="special">);</span>
 89<span class="special">};</span>
 90
 91<span class="identifier">A</span><span class="special">*</span> <span class="identifier">a</span> <span class="special">=</span> <span class="keyword">new</span> <span class="identifier">A</span><span class="special">;</span>
 92<span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
 93
 94<span class="special">(</span><span class="identifier">arg1</span><span class="special">-&gt;*&amp;</span><span class="identifier">A</span><span class="special">::</span><span class="identifier">func</span><span class="special">)(</span><span class="identifier">arg2</span><span class="special">)(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">i</span><span class="special">);</span> <span class="comment">// returns a-&gt;func(i)
 95</span></pre>
 96</div>
 97<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 98<td align="left"></td>
 99<td align="right"><div class="copyright-footer">Copyright &#169; 2002-2005, 2010 Joel de Guzman, Dan Marsden, Thomas Heller<p>
100        Distributed under the Boost Software License, Version 1.0. (See accompanying
101        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>)
102      </p>
103</div></td>
104</tr></table>
105<hr>
106<div class="spirit-nav">
107<a accesskey="p" href="../operator.html"><img src="../../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../operator.html"><img src="../../../images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../images/home.png" alt="Home"></a>
108</div>
109</body>
110</html>