forked from boostorg/fusion
Fusion: merged nview from trunk
[SVN r56490]
This commit is contained in:
@ -3,10 +3,10 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Functional</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
|
||||
<link rel="home" href="../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
|
||||
<link rel="up" href="../index.html" title="Chapter<65>1.<2E>Fusion 2.0">
|
||||
<link rel="previous" href="extension/iterator_facade.html" title="Iterator Facade">
|
||||
<link rel="prev" href="extension/iterator_facade.html" title="Iterator Facade">
|
||||
<link rel="next" href="functional/concepts.html" title="Concepts">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -22,13 +22,10 @@
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="extension/iterator_facade.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="functional/concepts.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage">
|
||||
<div><div><h2 class="title" style="clear: both">
|
||||
<a name="fusion.functional"></a><a href="functional.html" title="Functional">Functional</a>
|
||||
</h2></div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div class="section" title="Functional">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="fusion.functional"></a><a class="link" href="functional.html" title="Functional">Functional</a>
|
||||
</h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="functional/concepts.html">Concepts</a></span></dt>
|
||||
<dd><dl>
|
||||
@ -65,17 +62,17 @@
|
||||
Components to call functions and function objects and to make Fusion code callable
|
||||
through a function object interface.
|
||||
</p>
|
||||
<a name="fusion.functional.header"></a><h3>
|
||||
<a name="id607336"></a>
|
||||
<a href="functional.html#fusion.functional.header">Header</a>
|
||||
</h3>
|
||||
<a name="fusion.functional.header"></a><h4>
|
||||
<a name="id744896"></a>
|
||||
<a class="link" href="functional.html#fusion.functional.header">Header</a>
|
||||
</h4>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">functional</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
</pre>
|
||||
<a name="fusion.functional.fused_and_unfused_forms"></a><h3>
|
||||
<a name="id607418"></a>
|
||||
<a href="functional.html#fusion.functional.fused_and_unfused_forms">Fused and unfused
|
||||
<a name="fusion.functional.fused_and_unfused_forms"></a><h4>
|
||||
<a name="id744952"></a>
|
||||
<a class="link" href="functional.html#fusion.functional.fused_and_unfused_forms">Fused and unfused
|
||||
forms</a>
|
||||
</h3>
|
||||
</h4>
|
||||
<p>
|
||||
What is a function call?
|
||||
</p>
|
||||
@ -85,31 +82,31 @@
|
||||
It is a name and a tuple written next to each other, left-to-right.
|
||||
</p>
|
||||
<p>
|
||||
Although the C++ syntax does not allow to replace <tt class="literal">(a,b,c)</tt>
|
||||
with some Fusion <a href="sequence.html" title="Sequence">Sequence</a>, introducing
|
||||
Although the C++ syntax does not allow to replace <code class="literal">(a,b,c)</code>
|
||||
with some Fusion <a class="link" href="sequence.html" title="Sequence">Sequence</a>, introducing
|
||||
yet another function provides a solution:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">invoke</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span><span class="identifier">my_sequence</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
Alternatively it is possible to apply a simple transformation to <tt class="literal">f</tt>
|
||||
Alternatively it is possible to apply a simple transformation to <code class="literal">f</code>
|
||||
in order to achieve the same effect:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">f</span> <span class="identifier">tuple</span> <span class="special"><=></span> f' <span class="special">(</span><span class="identifier">tuple</span><span class="special">)</span>
|
||||
</pre>
|
||||
<p>
|
||||
Now, <tt class="literal">f'</tt> is an unary function that takes the arguments to
|
||||
<tt class="computeroutput"><span class="identifier">f</span></tt> as a tuple; <tt class="literal">f'</tt>
|
||||
is the <span class="emphasis"><em>fused</em></span> form of <tt class="computeroutput"><span class="identifier">f</span></tt>.
|
||||
Now, <code class="literal">f'</code> is an unary function that takes the arguments to
|
||||
<code class="computeroutput"><span class="identifier">f</span></code> as a tuple; <code class="literal">f'</code>
|
||||
is the <span class="emphasis"><em>fused</em></span> form of <code class="computeroutput"><span class="identifier">f</span></code>.
|
||||
Reading the above equivalence right-to-left to get the inverse transformation,
|
||||
<tt class="computeroutput"><span class="identifier">f</span></tt> is the <span class="emphasis"><em>unfused</em></span>
|
||||
form of <tt class="literal">f'</tt>.
|
||||
<code class="computeroutput"><span class="identifier">f</span></code> is the <span class="emphasis"><em>unfused</em></span>
|
||||
form of <code class="literal">f'</code>.
|
||||
</p>
|
||||
<a name="fusion.functional.calling_functions_and_function_objects"></a><h3>
|
||||
<a name="id607678"></a>
|
||||
<a href="functional.html#fusion.functional.calling_functions_and_function_objects">Calling
|
||||
<a name="fusion.functional.calling_functions_and_function_objects"></a><h4>
|
||||
<a name="id745136"></a>
|
||||
<a class="link" href="functional.html#fusion.functional.calling_functions_and_function_objects">Calling
|
||||
functions and function objects</a>
|
||||
</h3>
|
||||
</h4>
|
||||
<p>
|
||||
Having generic C++ code call back arbitrary functions provided by the client
|
||||
used to be a heavily repetitive task, as different functions can differ in
|
||||
@ -122,9 +119,8 @@
|
||||
</p>
|
||||
<p>
|
||||
Transforming an unfused function into its fused counterpart allows n-ary calls
|
||||
from an algorithm that invokes an unary <a href="functional/concepts/poly.html" title=" Polymorphic Function
|
||||
Object">Polymorphic
|
||||
Function Object</a> with <a href="sequence.html" title="Sequence">Sequence</a>
|
||||
from an algorithm that invokes an unary <a class="link" href="functional/concepts/poly.html" title="Polymorphic Function Object">Polymorphic
|
||||
Function Object</a> with <a class="link" href="sequence.html" title="Sequence">Sequence</a>
|
||||
arguments.
|
||||
</p>
|
||||
<p>
|
||||
@ -136,11 +132,11 @@
|
||||
<p>
|
||||
Constructors can be called applying <a href="http://www.boost.org/libs/functional/factory/doc/html/index.html" target="_top">Boost.Functional/Factory</a>.
|
||||
</p>
|
||||
<a name="fusion.functional.making_fusion_code_callable_through_a_function_object_interface"></a><h3>
|
||||
<a name="id607765"></a>
|
||||
<a href="functional.html#fusion.functional.making_fusion_code_callable_through_a_function_object_interface">Making
|
||||
<a name="fusion.functional.making_fusion_code_callable_through_a_function_object_interface"></a><h4>
|
||||
<a name="id745181"></a>
|
||||
<a class="link" href="functional.html#fusion.functional.making_fusion_code_callable_through_a_function_object_interface">Making
|
||||
Fusion code callable through a function object interface</a>
|
||||
</h3>
|
||||
</h4>
|
||||
<p>
|
||||
Transforming a fused function into its unfused counterpart allows to create
|
||||
function objects to accept arbitrary calls. In other words, an unary function
|
||||
|
Reference in New Issue
Block a user