• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Notes</title>
5<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../index.html" title="Chapter 1. Fusion 2.2">
8<link rel="up" href="../index.html" title="Chapter 1. Fusion 2.2">
9<link rel="prev" href="functional/generation/metafunctions/mk_unfused.html" title="make_unfused">
10<link rel="next" href="change_log.html" title="Change log">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="functional/generation/metafunctions/mk_unfused.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="change_log.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h2 class="title" style="clear: both">
27<a name="fusion.notes"></a><a class="link" href="notes.html" title="Notes">Notes</a>
28</h2></div></div></div>
29<h4>
30<a name="fusion.notes.h0"></a>
31      <span class="phrase"><a name="fusion.notes.recursive_inlined_functions"></a></span><a class="link" href="notes.html#fusion.notes.recursive_inlined_functions">Recursive
32      Inlined Functions</a>
33    </h4>
34<p>
35      An interesting peculiarity of functions like <a class="link" href="sequence/intrinsic/functions/at.html" title="at"><code class="computeroutput"><span class="identifier">at</span></code></a> when applied to a <a class="link" href="sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward
36      Sequence</a> like <a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a>
37      is that what could have been linear runtime complexity effectively becomes
38      constant O(1) due to compiler optimization of C++ inlined functions, however
39      deeply recursive (up to a certain compiler limit of course). Compile time complexity
40      remains linear.
41    </p>
42<h4>
43<a name="fusion.notes.h1"></a>
44      <span class="phrase"><a name="fusion.notes.overloaded_functions"></a></span><a class="link" href="notes.html#fusion.notes.overloaded_functions">Overloaded
45      Functions</a>
46    </h4>
47<p>
48      Associative sequences use function overloading to implement membership testing
49      and type associated key lookup. This amounts to constant runtime and amortized
50      constant compile time complexities. There is an overloaded function, <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">k</span><span class="special">)</span></code>, for each key <span class="emphasis"><em>type</em></span> <code class="computeroutput"><span class="identifier">k</span></code>. The compiler chooses the appropriate function
51      given a key, <code class="computeroutput"><span class="identifier">k</span></code>.
52    </p>
53<h4>
54<a name="fusion.notes.h2"></a>
55      <span class="phrase"><a name="fusion.notes.tag_dispatching"></a></span><a class="link" href="notes.html#fusion.notes.tag_dispatching">Tag
56      Dispatching</a>
57    </h4>
58<p>
59      Tag dispatching is a generic programming technique for selecting template specializations.
60      There are typically 3 components involved in the tag dispatching mechanism:
61    </p>
62<div class="orderedlist"><ol class="orderedlist" type="1">
63<li class="listitem">
64          A type for which an appropriate template specialization is required
65        </li>
66<li class="listitem">
67          A metafunction that associates the type with a tag type
68        </li>
69<li class="listitem">
70          A template that is specialized for the tag type
71        </li>
72</ol></div>
73<p>
74      For example, the fusion <code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin</span></code> metafunction
75      is implemented as follows:
76    </p>
77<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">&gt;</span>
78<span class="keyword">struct</span> <span class="identifier">begin</span>
79<span class="special">{</span>
80    <span class="keyword">typedef</span> <span class="keyword">typename</span>
81        <span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin_impl</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">&gt;::</span>
82        <span class="keyword">template</span> <span class="identifier">apply</span><span class="special">&lt;</span><span class="identifier">Sequence</span><span class="special">&gt;::</span><span class="identifier">type</span>
83    <span class="identifier">type</span><span class="special">;</span>
84<span class="special">};</span>
85</pre>
86<p>
87      In the case:
88    </p>
89<div class="orderedlist"><ol class="orderedlist" type="1">
90<li class="listitem">
91          <code class="computeroutput"><span class="identifier">Sequence</span></code> is the type for
92          which a suitable implementation of <code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin_impl</span></code>
93          is required
94        </li>
95<li class="listitem">
96          <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag_of</span></code> is the metafunction that associates
97          <code class="computeroutput"><span class="identifier">Sequence</span></code> with an appropriate
98          tag
99        </li>
100<li class="listitem">
101          <code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">begin_impl</span></code> is the template which is specialized
102          to provide an implementation for each tag type
103        </li>
104</ol></div>
105<h4>
106<a name="fusion.notes.h3"></a>
107      <span class="phrase"><a name="fusion.notes.extensibility"></a></span><a class="link" href="notes.html#fusion.notes.extensibility">Extensibility</a>
108    </h4>
109<p>
110      Unlike <a href="http://www.boost.org/libs/mpl" target="_top">MPL</a>, there is no
111      extensible sequence concept in fusion. This does not mean that Fusion sequences
112      are not extensible. In fact, all Fusion sequences are inherently extensible.
113      It is just that the manner of sequence extension in Fusion is different from
114      both <a href="http://en.wikipedia.org/wiki/Standard_Template_Library" target="_top">STL</a>
115      and <a href="http://www.boost.org/libs/mpl" target="_top">MPL</a> on account of the
116      lazy nature of fusion <a class="link" href="algorithm.html" title="Algorithm">Algorithms</a>.
117      <a href="http://en.wikipedia.org/wiki/Standard_Template_Library" target="_top">STL</a>
118      containers extend themselves in place though member functions such as <a class="link" href="algorithm/transformation/functions/push_back.html" title="push_back"><code class="computeroutput"><span class="identifier">push_back</span></code></a> and <a class="link" href="algorithm/transformation/functions/insert.html" title="insert"><code class="computeroutput"><span class="identifier">insert</span></code></a>. <a href="http://www.boost.org/libs/mpl" target="_top">MPL</a>
119      sequences, on the other hand, are extended through "intrinsic" functions
120      that actually return whole sequences. <a href="http://www.boost.org/libs/mpl" target="_top">MPL</a>
121      is purely functional and can not have side effects. For example, <a href="http://www.boost.org/libs/mpl" target="_top">MPL</a>'s
122      <code class="computeroutput"><span class="identifier">push_back</span></code> does not actually
123      mutate an <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span></code>. It can't do that. Instead, it returns
124      an extended <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span></code>.
125    </p>
126<p>
127      Like <a href="http://www.boost.org/libs/mpl" target="_top">MPL</a>, Fusion too is
128      purely functional and can not have side effects. With runtime efficiency in
129      mind, Fusion sequences are extended through generic functions that return
130      <a class="link" href="view.html" title="View">Views</a>. <a class="link" href="view.html" title="View">Views</a>
131      are sequences that do not actually contain data, but instead impart an alternative
132      presentation over the data from one or more underlying sequences. <a class="link" href="view.html" title="View">Views</a>
133      are proxies. They provide an efficient yet purely functional way to work on
134      potentially expensive sequence operations. For example, given a <a class="link" href="container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a>, Fusion's <a class="link" href="algorithm/transformation/functions/push_back.html" title="push_back"><code class="computeroutput"><span class="identifier">push_back</span></code></a> returns a <a class="link" href="view/joint_view.html" title="joint_view"><code class="computeroutput"><span class="identifier">joint_view</span></code></a>, instead of an actual extended
135      <a class="link" href="container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a>.
136      A <a class="link" href="view/joint_view.html" title="joint_view"><code class="computeroutput"><span class="identifier">joint_view</span></code></a>
137      holds a reference to the original sequence plus the appended data --making
138      it very cheap to pass around.
139    </p>
140<h4>
141<a name="fusion.notes.h4"></a>
142      <span class="phrase"><a name="fusion.notes.element_conversion"></a></span><a class="link" href="notes.html#fusion.notes.element_conversion">Element
143      Conversion</a>
144    </h4>
145<p>
146      Functions that take in elemental values to form sequences (e.g. <a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a>) convert their arguments
147      to something suitable to be stored as a sequence element. In general, the element
148      types are stored as plain values. Example:
149    </p>
150<pre class="programlisting"><a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="char">'x'</span><span class="special">)</span>
151</pre>
152<p>
153      returns a <a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a><code class="computeroutput"><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span>
154      <span class="keyword">char</span><span class="special">&gt;</span></code>.
155    </p>
156<p>
157      There are a few exceptions, however.
158    </p>
159<p>
160      <span class="bold"><strong>Arrays:</strong></span>
161    </p>
162<p>
163      Array arguments are deduced to reference to const types. For example <a href="#ftn.fusion.notes.f0" class="footnote" name="fusion.notes.f0"><sup class="footnote">[14]</sup></a>:
164    </p>
165<pre class="programlisting"><a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="string">"Donald"</span><span class="special">,</span> <span class="string">"Daisy"</span><span class="special">)</span>
166</pre>
167<p>
168      creates a <a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a>
169      of type
170    </p>
171<pre class="programlisting"><a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">char</span> <span class="special">(&amp;)[</span><span class="number">7</span><span class="special">],</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">(&amp;)[</span><span class="number">6</span><span class="special">]&gt;</span>
172</pre>
173<p>
174      <span class="bold"><strong>Function pointers:</strong></span>
175    </p>
176<p>
177      Function pointers are deduced to the plain non-reference type (i.e. to plain
178      function pointer). Example:
179    </p>
180<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">);</span>
181  <span class="special">...</span>
182<a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(&amp;</span><span class="identifier">f</span><span class="special">);</span>
183</pre>
184<p>
185      creates a <a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a>
186      of type
187    </p>
188<pre class="programlisting"><a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a><span class="special">&lt;</span><span class="keyword">void</span> <span class="special">(*)(</span><span class="keyword">int</span><span class="special">)&gt;</span>
189</pre>
190<h4>
191<a name="fusion.notes.h5"></a>
192      <span class="phrase"><a name="fusion.notes.reference_wrappers"></a></span><a class="link" href="notes.html#fusion.notes.reference_wrappers">Reference
193      Wrappers</a>
194    </h4>
195<p>
196      Fusion's generation functions (e.g. <a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a>) by default stores the element
197      types as plain non-reference types. Example:
198    </p>
199<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">foo</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">A</span><span class="special">&amp;</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&amp;</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">{</span>
200    <span class="special">...</span>
201    <a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span>
202</pre>
203<p>
204      creates a <a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a>
205      of type
206    </p>
207<pre class="programlisting"><a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a><span class="special">&lt;</span><span class="identifier">A</span><span class="special">,</span> <span class="identifier">B</span><span class="special">&gt;</span>
208</pre>
209<p>
210      Sometimes the plain non-reference type is not desired. You can use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span></code>
211      and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">cref</span></code> to store references or const references
212      (respectively) instead. The mechanism does not compromise const correctness
213      since a const object wrapped with ref results in a tuple element with const
214      reference type (see the fifth code line below). Examples:
215    </p>
216<p>
217      For example:
218    </p>
219<pre class="programlisting"><span class="identifier">A</span> <span class="identifier">a</span><span class="special">;</span> <span class="identifier">B</span> <span class="identifier">b</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">A</span> <span class="identifier">ca</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">;</span>
220<a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="identifier">cref</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span> <span class="identifier">b</span><span class="special">);</span>          <span class="comment">// creates list&lt;const A&amp;, B&gt;</span>
221<a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span> <span class="identifier">b</span><span class="special">);</span>           <span class="comment">// creates list&lt;A&amp;, B&gt;</span>
222<a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">a</span><span class="special">),</span> <span class="identifier">cref</span><span class="special">(</span><span class="identifier">b</span><span class="special">));</span>     <span class="comment">// creates list&lt;A&amp;, const B&amp;&gt;</span>
223<a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="identifier">cref</span><span class="special">(</span><span class="identifier">ca</span><span class="special">));</span>            <span class="comment">// creates list&lt;const A&amp;&gt;</span>
224<a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">ca</span><span class="special">));</span>             <span class="comment">// creates list&lt;const A&amp;&gt;</span>
225</pre>
226<p>
227      See <a href="http://www.boost.org/libs/core/ref.html" target="_top">Ref utility</a>
228      for details.
229    </p>
230<p>
231      Since C++11, the standard reference wrappers (<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ref</span></code> and
232      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cref</span></code>) work as well.
233    </p>
234<h4>
235<a name="fusion.notes.h6"></a>
236      <span class="phrase"><a name="fusion.notes.adt_attribute_proxy"></a></span><a class="link" href="notes.html#fusion.notes.adt_attribute_proxy">adt_attribute_proxy</a>
237    </h4>
238<p>
239      To adapt arbitrary data types that do not allow direct access to their members,
240      but allow indirect access via expressions (such as invocations of get- and
241      set-methods), fusion's <code class="literal">BOOST_FUSION_ADAPT_<span class="emphasis"><em>xxx</em></span>ADT<span class="emphasis"><em>xxx</em></span></code>-family
242      (e.g. <a class="link" href="adapted/adapt_adt.html" title="BOOST_FUSION_ADAPT_ADT"><code class="computeroutput"><span class="identifier">BOOST_FUSION_ADAPT_ADT</span></code></a>)
243      may be used. To bypass the restriction of not having actual lvalues that represent
244      the elements of the fusion sequence, but rather a sequence of paired expressions
245      that access the elements, the actual return type of fusion's intrinsic sequence
246      access functions (<a class="link" href="sequence/intrinsic/functions/at.html" title="at"><code class="computeroutput"><span class="identifier">at</span></code></a>, <a class="link" href="sequence/intrinsic/functions/at_c.html" title="at_c"><code class="computeroutput"><span class="identifier">at_c</span></code></a>, <a class="link" href="sequence/intrinsic/functions/at_key.html" title="at_key"><code class="computeroutput"><span class="identifier">at_key</span></code></a>, <a class="link" href="iterator/functions/deref.html" title="deref"><code class="computeroutput"><span class="identifier">deref</span></code></a>, and <a class="link" href="iterator/functions/deref_data.html" title="deref_data"><code class="computeroutput"><span class="identifier">deref_data</span></code></a>) is a proxy type, an instance
247      of <code class="computeroutput"><span class="identifier">adt_attribute_proxy</span></code>, that
248      encapsulates these expressions.
249    </p>
250<p>
251      <code class="computeroutput"><span class="identifier">adt_attribute_proxy</span></code> is defined
252      in the namespace <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">extension</span></code> and has three template arguments:
253    </p>
254<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">fusion</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">extension</span>
255<span class="special">{</span>
256    <span class="keyword">template</span><span class="special">&lt;</span>
257        <span class="keyword">typename</span> <span class="identifier">Type</span>
258      <span class="special">,</span> <span class="keyword">int</span> <span class="identifier">Index</span>
259      <span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">Const</span>
260    <span class="special">&gt;</span>
261    <span class="keyword">struct</span> <span class="identifier">adt_attribute_proxy</span><span class="special">;</span>
262<span class="special">}}}</span>
263</pre>
264<p>
265      When adapting a class type, <code class="computeroutput"><span class="identifier">adt_attribute_proxy</span></code>
266      is specialized for every element of the adapted sequence, with <code class="computeroutput"><span class="identifier">Type</span></code> being the class type that is adapted,
267      <code class="computeroutput"><span class="identifier">Index</span></code> the 0-based indices of
268      the elements, and <code class="computeroutput"><span class="identifier">Const</span></code> both
269      <code class="computeroutput"><span class="keyword">true</span></code> and <code class="computeroutput"><span class="keyword">false</span></code>.
270      The return type of fusion's intrinsic sequence access functions for the <span class="emphasis"><em>N</em></span>th
271      element of an adapted class type <code class="computeroutput"><span class="identifier">type_name</span></code>
272      is <code class="literal">adt_attribute_proxy&lt;type_name, <span class="emphasis"><em>N</em></span>, <span class="emphasis"><em>Const</em></span>&gt;</code>,
273      with <code class="literal"><span class="emphasis"><em>Const</em></span></code> being <code class="computeroutput"><span class="keyword">true</span></code>
274      for constant instances of <code class="computeroutput"><span class="identifier">type_name</span></code>
275      and <code class="computeroutput"><span class="keyword">false</span></code> for non-constant ones.
276    </p>
277<div class="variablelist">
278<p class="title"><b>Notation</b></p>
279<dl class="variablelist">
280<dt><span class="term"><code class="computeroutput"><span class="identifier">type_name</span></code></span></dt>
281<dd><p>
282            The type to be adapted, with M attributes
283          </p></dd>
284<dt><span class="term"><code class="computeroutput"><span class="identifier">inst</span></code></span></dt>
285<dd><p>
286            Object of type <code class="computeroutput"><span class="identifier">type_name</span></code>
287          </p></dd>
288<dt><span class="term"><code class="computeroutput"><span class="identifier">const_inst</span></code></span></dt>
289<dd><p>
290            Object of type <code class="computeroutput"><span class="identifier">type_name</span> <span class="keyword">const</span></code>
291          </p></dd>
292<dt><span class="term"><code class="literal">(attribute_type<span class="emphasis"><em>N</em></span>, attribute_const_type<span class="emphasis"><em>N</em></span>,
293        get_expr<span class="emphasis"><em>N</em></span>, set_expr<span class="emphasis"><em>N</em></span>)</code></span></dt>
294<dd><p>
295            Attribute descriptor of the <span class="emphasis"><em>N</em></span>th attribute of <code class="computeroutput"><span class="identifier">type_name</span></code> as passed to the adaption
296            macro, 0≤<span class="emphasis"><em>N</em></span>&lt;M
297          </p></dd>
298<dt><span class="term"><code class="literal">proxy_type<span class="emphasis"><em>N</em></span></code></span></dt>
299<dd><p>
300            <code class="literal">adt_attribute_proxy&lt;type_name, <span class="emphasis"><em>N</em></span>, <code class="computeroutput"><span class="keyword">false</span></code>&gt;</code> with <span class="emphasis"><em>N</em></span>
301            being an integral constant, 0≤<span class="emphasis"><em>N</em></span>&lt;M
302          </p></dd>
303<dt><span class="term"><code class="literal">const_proxy_type<span class="emphasis"><em>N</em></span></code></span></dt>
304<dd><p>
305            <code class="literal">adt_attribute_proxy&lt;type_name, <span class="emphasis"><em>N</em></span>, <code class="computeroutput"><span class="keyword">true</span></code>&gt;</code> with <span class="emphasis"><em>N</em></span>
306            being an integral constant, 0≤<span class="emphasis"><em>N</em></span>&lt;M
307          </p></dd>
308<dt><span class="term"><code class="literal">proxy<span class="emphasis"><em>N</em></span></code></span></dt>
309<dd><p>
310            Object of type <code class="literal">proxy_type<span class="emphasis"><em>N</em></span></code>
311          </p></dd>
312<dt><span class="term"><code class="literal">const_proxy<span class="emphasis"><em>N</em></span></code></span></dt>
313<dd><p>
314            Object of type <code class="literal">const_proxy_type<span class="emphasis"><em>N</em></span></code>
315          </p></dd>
316</dl>
317</div>
318<p>
319      <span class="bold"><strong>Expression Semantics</strong></span>
320    </p>
321<div class="informaltable"><table class="table">
322<colgroup>
323<col>
324<col>
325</colgroup>
326<thead><tr>
327<th>
328              <p>
329                Expression
330              </p>
331            </th>
332<th>
333              <p>
334                Semantics
335              </p>
336            </th>
337</tr></thead>
338<tbody>
339<tr>
340<td>
341              <p>
342                <code class="literal">proxy_type<span class="emphasis"><em>N</em></span>(inst)</code>
343              </p>
344            </td>
345<td>
346              <p>
347                Creates an instance of <code class="literal">proxy_type<span class="emphasis"><em>N</em></span></code>
348                with underlying object <code class="computeroutput"><span class="identifier">inst</span></code>
349              </p>
350            </td>
351</tr>
352<tr>
353<td>
354              <p>
355                <code class="literal">const_proxy_type<span class="emphasis"><em>N</em></span>(const_inst)</code>
356              </p>
357            </td>
358<td>
359              <p>
360                Creates an instance of <code class="literal">const_proxy_type<span class="emphasis"><em>N</em></span></code>
361                with underlying object <code class="computeroutput"><span class="identifier">const_inst</span></code>
362              </p>
363            </td>
364</tr>
365<tr>
366<td>
367              <p>
368                <code class="literal">proxy_type<span class="emphasis"><em>N</em></span>::type</code>
369              </p>
370            </td>
371<td>
372              <p>
373                Another name for <code class="literal">attribute_type<span class="emphasis"><em>N</em></span></code>
374              </p>
375            </td>
376</tr>
377<tr>
378<td>
379              <p>
380                <code class="literal">const_proxy_type<span class="emphasis"><em>N</em></span>::type</code>
381              </p>
382            </td>
383<td>
384              <p>
385                Another name for <code class="literal">const_attribute_type<span class="emphasis"><em>N</em></span></code>
386              </p>
387            </td>
388</tr>
389<tr>
390<td>
391              <p>
392                <code class="literal">proxy<span class="emphasis"><em>N</em></span>=t</code>
393              </p>
394            </td>
395<td>
396              <p>
397                Invokes <code class="literal">set_expr<span class="emphasis"><em>N</em></span></code>, with
398                <code class="computeroutput"><span class="identifier">t</span></code> being an arbitrary
399                object. <code class="literal">set_expr<span class="emphasis"><em>N</em></span></code> may access
400                the variables named <code class="computeroutput"><span class="identifier">obj</span></code>
401                of type <code class="computeroutput"><span class="identifier">type_name</span><span class="special">&amp;</span></code>, which represent the corresponding
402                instance of <code class="computeroutput"><span class="identifier">type_name</span></code>,
403                and <code class="computeroutput"><span class="identifier">val</span></code> of an arbitrary
404                const-qualified reference template type parameter <code class="computeroutput"><span class="identifier">Val</span></code>,
405                which represents <code class="computeroutput"><span class="identifier">t</span></code>.
406              </p>
407            </td>
408</tr>
409<tr>
410<td>
411              <p>
412                <code class="literal">proxy<span class="emphasis"><em>N</em></span>.get()</code>
413              </p>
414            </td>
415<td>
416              <p>
417                Invokes <code class="literal">get_expr<span class="emphasis"><em>N</em></span></code> and forwards
418                its return value. <code class="literal">get_expr<span class="emphasis"><em>N</em></span></code>
419                may access the variable named <code class="computeroutput"><span class="identifier">obj</span></code>
420                of type <code class="computeroutput"><span class="identifier">type_name</span><span class="special">&amp;</span></code> which represents the underlying
421                instance of <code class="computeroutput"><span class="identifier">type_name</span></code>.
422                <code class="literal">attribute_type<span class="emphasis"><em>N</em></span></code> may specify
423                the type that <code class="literal">get_expr<span class="emphasis"><em>N</em></span></code> denotes
424                to.
425              </p>
426            </td>
427</tr>
428<tr>
429<td>
430              <p>
431                <code class="literal">const_proxy<span class="emphasis"><em>N</em></span>.get()</code>
432              </p>
433            </td>
434<td>
435              <p>
436                Invokes <code class="literal">get_expr<span class="emphasis"><em>N</em></span></code> and forwards
437                its return value. <code class="literal">get_expr<span class="emphasis"><em>N</em></span></code>
438                may access the variable named <code class="computeroutput"><span class="identifier">obj</span></code>
439                of type <code class="computeroutput"><span class="identifier">type_name</span> <span class="keyword">const</span><span class="special">&amp;</span></code>
440                which represents the underlying instance of <code class="computeroutput"><span class="identifier">type_name</span></code>.
441                <code class="literal">attribute_const_type<span class="emphasis"><em>N</em></span></code> may
442                specify the type that <code class="literal">get_expr<span class="emphasis"><em>N</em></span></code>
443                denotes to.
444              </p>
445            </td>
446</tr>
447</tbody>
448</table></div>
449<p>
450      Additionally, <code class="literal">proxy_type<span class="emphasis"><em>N</em></span></code> and <code class="literal">const_proxy_type<span class="emphasis"><em>N</em></span></code>
451      are copy constructible, copy assignable and implicitly convertible to <code class="literal">proxy_type<span class="emphasis"><em>N</em></span>::type</code>
452      or <code class="literal">const_proxy_type<span class="emphasis"><em>N</em></span>::type</code>.
453    </p>
454<div class="tip"><table border="0" summary="Tip">
455<tr>
456<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../doc/src/images/tip.png"></td>
457<th align="left">Tip</th>
458</tr>
459<tr><td align="left" valign="top"><p>
460        To avoid the pitfalls of the proxy type, an arbitrary class type may also
461        be adapted directly using fusion's <a class="link" href="extension.html" title="Extension">intrinsic
462        extension mechanism</a>.
463      </p></td></tr>
464</table></div>
465<div class="footnotes">
466<br><hr style="width:100; text-align:left;margin-left: 0">
467<div id="ftn.fusion.notes.f0" class="footnote"><p><a href="#fusion.notes.f0" class="para"><sup class="para">[14] </sup></a>
468        Note that the type of a string literal is an array of const characters, not
469        <code class="computeroutput"><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span></code>. To get <a class="link" href="container/generation/functions/make_list.html" title="make_list"><code class="computeroutput"><span class="identifier">make_list</span></code></a> to create a <a class="link" href="container/list.html" title="list"><code class="computeroutput"><span class="identifier">list</span></code></a> with an element of a non-const
470        array type one must use the <code class="computeroutput"><span class="identifier">ref</span></code>
471        wrapper (see <a class="link" href="notes.html#fusion.notes.reference_wrappers"><code class="computeroutput"><span class="identifier">Reference</span> <span class="identifier">Wrappers</span></code></a>).
472      </p></div>
473</div>
474</div>
475<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
476<td align="left"></td>
477<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
478      Dan Marsden, Tobias Schwinger<p>
479        Distributed under the Boost Software License, Version 1.0. (See accompanying
480        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>)
481      </p>
482</div></td>
483</tr></table>
484<hr>
485<div class="spirit-nav">
486<a accesskey="p" href="functional/generation/metafunctions/mk_unfused.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="change_log.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
487</div>
488</body>
489</html>
490