|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71705 - in sandbox/local: boost/local libs/local/doc/html libs/local/doc/html/boost_local libs/local/doc/qbk
From: lorcaminiti_at_[hidden]
Date: 2011-05-03 19:54:30
Author: lcaminiti
Date: 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
New Revision: 71705
URL: http://svn.boost.org/trac/boost/changeset/71705
Log:
Removed local::funciton from docs.
Text files modified:
sandbox/local/boost/local/function.hpp | 29
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html | 2
sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html | 8
sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 12
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html | 12
sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html | 2
sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html | 2
sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html | 841 ++++++++++++++++++---------------------
sandbox/local/libs/local/doc/html/boost_local/Examples.html | 8
sandbox/local/libs/local/doc/html/boost_local/Implementation.html | 23
sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html | 16
sandbox/local/libs/local/doc/html/index.html | 4
sandbox/local/libs/local/doc/html/reference.html | 5
sandbox/local/libs/local/doc/html/standalone_HTML.manifest | 1
sandbox/local/libs/local/doc/qbk/advanced_topics.qbk | 128 ++---
sandbox/local/libs/local/doc/qbk/local.qbk | 4
25 files changed, 518 insertions(+), 597 deletions(-)
Modified: sandbox/local/boost/local/function.hpp
==============================================================================
--- sandbox/local/boost/local/function.hpp (original)
+++ sandbox/local/boost/local/function.hpp 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -111,8 +111,8 @@
* }
* @EndParams
*
- * @Note Local functions are functors. They cannot be copied but they can be
- * assigned to other functor objects like @RefClass{boost::local::function}.
+ * @Note Local functions are functors so they can be assigned to other functors
+ * like <c>boost::function</c> (see Boost.Function).
*
* @Note This macro cannot be used multiple times on the same line because it
* internally uses the line number <c>__LINE__</c> to generate unique
@@ -120,7 +120,7 @@
*
* @See @RefSect{Tutorial} section, @RefSect2{Advanced_Topics, Advanced Topics}
* section, @RefMacro{BOOST_LOCAL_FUNCTION_PARAMS_TPL},
- * @RefMacro{BOOST_LOCAL_FUNCTION_NAME}, @RefClass{boost::local::function}.
+ * @RefMacro{BOOST_LOCAL_FUNCTION_NAME}, Boost.Function.
*/
#define BOOST_LOCAL_FUNCTION_PARAMS(parameters) \
BOOST_LOCAL_AUX_FUNCTION_PARAMS(parameters, \
@@ -158,25 +158,30 @@
* This macro must follow the local function body code block <c>{ ... }</c> as
* shown in the @RefMacro{BOOST_LOCAL_FUNCTION_PARAMS} documentation.
*
- * The local function name can be prefixed by the "keyword" <c>inline</c> as in
- * <c>BOOST_LOCAL_FUNCTION_NAME(inline <em>name</em>)</c> to increase the
- * chances that the compiler will be able to inline the local function calls
- * (thus reducing their run-time).
+ * The local function name can be prefixed by the "keyword" <c>inline</c>:
+ * @code
+ * ... BOOST_LOCAL_FUNCTION_NAME(inline name)
+ * @endcode</c>
+ * This increases the chances that the compiler will be able to inline the
+ * local function calls (thus reducing their run-time).
* However, inlined local functions cannot be passed as template parameters
* (on ISO C++ compliant compilers, see
* @RefMacro{BOOST_LOCAL_CONFIG_COMPLIANT}, but they can be passed as template
* parameters on C++0x compilers).
- * Furthermore, inlined local functions cannot be assigned to
- * @RefClass{boost::local::function}.
+ * Furthermore, inlined local functions cannot be assigned to other functors
+ * like <c>boost::function</c>.
* On C++0x compilers, there is no need to declare a local function lined
* because this library will automatically use C++0x specific features to
* inline the local function while always allowing to pass it as a template
* parameter.
*
* The local function name can also be prefixed by the "keyword"
- * <c>recursive</c> as in
- * <c>BOOST_LOCAL_FUNCTION_NAME(recursive <em>name</em>)</c> to allow the
- * local function to recursively call itself from its body (as usual in C++).
+ * <c>recursive</c>:
+ * @code
+ * ... BOOST_LOCAL_FUNCTION_NAME(recursive name)
+ * @endcode
+ * This allows the local function to recursively call itself from its body (as
+ * usual in C++).
* However, compilers have not been observed to be able to inline recursive
* local function calls (not even when the recursive local function is also
* declared inlined).
Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_TYPE.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_TYPE(parenthesized_type)</pre></div>
<div class="refsect1">
-<a name="id918192"></a><h2>Description</h2>
+<a name="id914796"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified type at compile-time (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
<p>For example <code class="computeroutput">BOOST_IDENTITY_TYPE((std::map<int, double>))</code> can be passed as a single macro parameter when instead <code class="computeroutput">std::map<int, double></code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_IDENTITY_VALUE.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_IDENTITY_VALUE(parenthesized_value)</pre></div>
<div class="refsect1">
-<a name="id918333"></a><h2>Description</h2>
+<a name="id914937"></a><h2>Description</h2>
<p>This macro expands to an expression that can be passed as a single macro parameter even if it contains commas and that evaluates to the specified value at run-time (see the <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section).</p>
<p>For example <code class="computeroutput">BOOST_IDENTITY_VALUE((key_sizeof<int, double>::value))</code> can be passed as a single macro parameter when instead <code class="computeroutput">key_sizeof<int, double>::value</code> cannot (because it contains a comma not wrapped by round parenthesis so it will be interpreted as two separate macro parameters by the preprocessor).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK(bindings)</pre></div>
<div class="refsect1">
-<a name="id913007"></a><h2>Description</h2>
+<a name="id910895"></a><h2>Description</h2>
<p>This macro must be used within a declarative context, it must be followed by the local block body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK_END.html" title="Macro BOOST_LOCAL_BLOCK_END">BOOST_LOCAL_BLOCK_END</a></code> macro (see the Tutorial section): </p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
<span class="special">...</span>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_END.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK_END</pre></div>
<div class="refsect1">
-<a name="id913745"></a><h2>Description</h2>
+<a name="id911633"></a><h2>Description</h2>
<p>This macro must follow the local block body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code> documentation.</p>
<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_BLOCK_TPL.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_BLOCK_TPL(bindings)</pre></div>
<div class="refsect1">
-<a name="id913671"></a><h2>Description</h2>
+<a name="id911559"></a><h2>Description</h2>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_COMPLIANT.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_COMPLIANT</pre></div>
<div class="refsect1">
-<a name="id913912"></a><h2>Description</h2>
+<a name="id911800"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, its default value is to be left not defined.</p>
<p>If this macro is defined, variadic macros and empty macro parameters are not used by this library. Using variadic macros and empty macro parameters allows this library to provide the <span class="emphasis"><em>variadic macro</em></span> and <span class="emphasis"><em>empty macro</em></span> syntaxes which some programmers might find more readable than the <span class="emphasis"><em>sequencing macro</em></span> syntax (see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_BLOCK.html" title="Macro BOOST_LOCAL_BLOCK">BOOST_LOCAL_BLOCK</a></code>, and <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>). If this configuration macro is defined then only the sequencing macro syntax is allowed (regardless of whether the compiler supports variadic and e
mpty macros or not).</p>
<p><span class="bold"><strong>Warning:</strong></span> The variadic and empty macro syntaxes are not supported by all C++ compilers so they should be used with care to avoid portability issues (and this configuration macro can be defined to disable them).</p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_FUNCTION_ARITY_MAX</pre></div>
<div class="refsect1">
-<a name="id914117"></a><h2>Description</h2>
+<a name="id912005"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, its default value is <code class="computeroutput">5</code>.</p>
<p>This only refers to the number of local function parameters and not to the number of bound variables in scope (the limit on the number of bound variables is instead the maximum size allowed for a Boost.Preprocessor sequences).</p>
<p><span class="bold"><strong>Warning:</strong></span> Increasing this number will increase compilation time.</p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_CONFIG_THIS_PARAM_NAME.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_CONFIG_THIS_PARAM_NAME</pre></div>
<div class="refsect1">
-<a name="id914212"></a><h2>Description</h2>
+<a name="id912100"></a><h2>Description</h2>
<p>If programmers leave this configuration macro undefined, the default symbol used is <code class="computeroutput">this_</code>.</p>
<p><span class="bold"><strong>Warning:</strong></span> Programmers should not define this macro unless it is absolutely necessary (e.g., to avoid name clashes with another library which cannot be changed). Changing the symbol <code class="computeroutput">this_</code> effectively changes the public API of this library.</p>
<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Getting_Started.html" title="Getting Started"> Getting Started</a> section. </p>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT(binding_list)</pre></div>
<div class="refsect1">
-<a name="id914352"></a><h2>Description</h2>
+<a name="id912241"></a><h2>Description</h2>
<p>This macro must be used within a declarative context, it must be followed by the local exit body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT_END.html" title="Macro BOOST_LOCAL_EXIT_END">BOOST_LOCAL_EXIT_END</a></code> macro (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section): </p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
<span class="special">...</span>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_END.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -7,7 +7,7 @@
<link rel="home" href="index.html" title="Boost.Local 0.2.0">
<link rel="up" href="reference.html#header.boost.local.exit_hpp" title="Header <boost/local/exit.hpp>">
<link rel="prev" href="BOOST_LOCAL_EXIT_TPL.html" title="Macro BOOST_LOCAL_EXIT_TPL">
-<link rel="next" href="boost/local/function.html" title="Struct template function">
+<link rel="next" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_EXIT_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.exit_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="boost/local/function.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_EXIT_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.exit_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="BOOST_LOCAL_FUNCTION_PARAMS.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_LOCAL_EXIT_END"></a><div class="titlepage"></div>
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT_END</pre></div>
<div class="refsect1">
-<a name="id915103"></a><h2>Description</h2>
+<a name="id912992"></a><h2>Description</h2>
<p>This macro must follow the local exit body code <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code> documentation.</p>
<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
@@ -49,7 +49,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="BOOST_LOCAL_EXIT_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.exit_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="boost/local/function.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_EXIT_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.exit_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="BOOST_LOCAL_FUNCTION_PARAMS.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_EXIT_TPL.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_EXIT_TPL(binding_list)</pre></div>
<div class="refsect1">
-<a name="id915029"></a><h2>Description</h2>
+<a name="id912918"></a><h2>Description</h2>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_EXIT.html" title="Macro BOOST_LOCAL_EXIT">BOOST_LOCAL_EXIT</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_NAME.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,10 +33,16 @@
</span>BOOST_LOCAL_FUNCTION_NAME(name)</pre></div>
<div class="refsect1">
-<a name="id917565"></a><h2>Description</h2>
+<a name="id914117"></a><h2>Description</h2>
<p>This macro must follow the local function body code block <code class="computeroutput">{ ... }</code> as shown in the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code> documentation.</p>
-<p>The local function name can be prefixed by the "keyword" <code class="computeroutput">inline</code> as in <code class="computeroutput">BOOST_LOCAL_FUNCTION_NAME(inline <span class="emphasis"><em>name</em></span>)</code> to increase the chances that the compiler will be able to inline the local function calls (thus reducing their run-time). However, inlined local functions cannot be passed as template parameters (on ISO C++ compliant compilers, see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">BOOST_LOCAL_CONFIG_COMPLIANT</a></code>, but they can be passed as template parameters on C++0x compilers). Furthermore, inlined local functions cannot be assigned to <code class="computeroutput"><a class="link" href="boost/local/function.html" title="Struct template function">boost::local::function</a></code>. On C++0x compilers, there is no need to declare a local function lined because this library will automatically use C++0x sp
ecific features to inline the local function while always allowing to pass it as a template parameter.</p>
-<p>The local function name can also be prefixed by the "keyword" <code class="computeroutput">recursive</code> as in <code class="computeroutput">BOOST_LOCAL_FUNCTION_NAME(recursive <span class="emphasis"><em>name</em></span>)</code> to allow the local function to recursively call itself from its body (as usual in C++). However, compilers have not been observed to be able to inline recursive local function calls (not even when the recursive local function is also declared inlined).</p>
+<p>The local function name can be prefixed by the "keyword" <code class="computeroutput">inline</code>: </p>
+<pre class="programlisting"> <span class="special">...</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="keyword">inline</span> <span class="identifier">name</span><span class="special">)</span>
+</pre>
+<p> This increases the chances that the compiler will be able to inline the local function calls (thus reducing their run-time). However, inlined local functions cannot be passed as template parameters (on ISO C++ compliant compilers, see <code class="computeroutput"><a class="link" href="BOOST_LOCAL_CONFIG_COMPLIANT.html" title="Macro BOOST_LOCAL_CONFIG_COMPLIANT">BOOST_LOCAL_CONFIG_COMPLIANT</a></code>, but they can be passed as template parameters on C++0x compilers). Furthermore, inlined local functions cannot be assigned to other functors like <code class="computeroutput">boost::function</code>. On C++0x compilers, there is no need to declare a local function lined because this library will automatically use C++0x specific features to inline the local function while always allowing to pass it as a template parameter.</p>
+<p>The local function name can also be prefixed by the "keyword" <code class="computeroutput">recursive</code>: </p>
+<pre class="programlisting"> <span class="special">...</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">recursive</span> <span class="identifier">name</span><span class="special">)</span>
+</pre>
+<p> This allows the local function to recursively call itself from its body (as usual in C++). However, compilers have not been observed to be able to inline recursive local function calls (not even when the recursive local function is also declared inlined).</p>
<p><span class="bold"><strong>Parameters:</strong></span> </p>
<div class="informaltable"><table class="table">
<colgroup>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -6,7 +6,7 @@
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Boost.Local 0.2.0">
<link rel="up" href="reference.html#header.boost.local.function_hpp" title="Header <boost/local/function.hpp>">
-<link rel="prev" href="boost/local/function.html" title="Struct template function">
+<link rel="prev" href="BOOST_LOCAL_EXIT_END.html" title="Macro BOOST_LOCAL_EXIT_END">
<link rel="next" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="boost/local/function.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_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="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_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="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="BOOST_LOCAL_FUNCTION_PARAMS"></a><div class="titlepage"></div>
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS(parameters)</pre></div>
<div class="refsect1">
-<a name="id916591"></a><h2>Description</h2>
+<a name="id913159"></a><h2>Description</h2>
<p>This macro must be used within a declarative context, it must follow the local function result type, it must be followed by the local function body code and then by the <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code> macro (see the <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> and <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> sections): </p>
<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some declarative context.</span>
<span class="special">...</span>
@@ -83,9 +83,9 @@
</table></div>
<p>
</p>
-<p><span class="bold"><strong>Note:</strong></span> Local functions are functors. They cannot be copied but they can be assigned to other functor objects like <code class="computeroutput"><a class="link" href="boost/local/function.html" title="Struct template function">boost::local::function</a></code>.</p>
+<p><span class="bold"><strong>Note:</strong></span> Local functions are functors so they can be assigned to other functors like <code class="computeroutput">boost::function</code> (see Boost.Function).</p>
<p><span class="bold"><strong>Note:</strong></span> This macro cannot be used multiple times on the same line because it internally uses the line number <code class="computeroutput">__LINE__</code> to generate unique identifiers.</p>
-<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>, <code class="computeroutput"><a class="link" href="boost/local/function.html" title="Struct template function">boost::local::function</a></code>. </p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section, <a class="link" href="boost_local/Advanced_Topics.html" title="Advanced Topics"> Advanced Topics</a> section, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a></code>, Boost.Function. </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
@@ -98,7 +98,7 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="boost/local/function.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_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="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="BOOST_LOCAL_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.local.function_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="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_FUNCTION_PARAMS_TPL.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_FUNCTION_PARAMS_TPL(parameters)</pre></div>
<div class="refsect1">
-<a name="id917491"></a><h2>Description</h2>
+<a name="id914042"></a><h2>Description</h2>
<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>, <a class="link" href="boost_local/Tutorial.html" title="Tutorial">Tutorial</a> section. </p>
</div>
</div>
Modified: sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html
==============================================================================
--- sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html (original)
+++ sandbox/local/libs/local/doc/html/BOOST_LOCAL_TYPEOF.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -33,7 +33,7 @@
</span>BOOST_LOCAL_TYPEOF(bound_variable_name)</pre></div>
<div class="refsect1">
-<a name="id917864"></a><h2>Description</h2>
+<a name="id914468"></a><h2>Description</h2>
<p>The type is fully qualified in that it contains the extra constant and reference qualifiers when they are specified for binding by constant and by reference. For example, if a variable named <code class="computeroutput">t</code> of type <code class="computeroutput">T</code> is: </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>Bound by value using <code class="computeroutput">bind t</code> then <code class="computeroutput">BOOST_LOCAL_TYPEOF(t)</code> is <code class="computeroutput">T</code>. </p></li>
Modified: sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Advanced_Topics.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -29,20 +29,20 @@
<div class="toc"><dl>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.commas_and_symbols_in_macro_parameters">Commas
and Symbols in Macro Parameters</a></span></dt>
-<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.deducing_bound_types__concepts__etc_">Deducing
- Bound Types (concepts, etc)</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.passing_local_functions">Passing
Local Functions</a></span></dt>
+<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.deducing_bound_types__concepts__etc_">Deducing
+ Bound Types (concepts, etc)</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.exception_specifications">Exception
Specifications</a></span></dt>
-<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.storage_classifiers___auto__and__register__">Storage
- Classifiers (<code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code>)</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.inlined_local_functions">Inlined
Local Functions</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.recursive_local_functions">Recursive
Local Functions</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.nested_declarations">Nested
Declarations</a></span></dt>
+<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.storage_classifiers___auto__and__register__">Storage
+ Classifiers (<code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code>)</a></span></dt>
<dt><span class="section"><a href="Advanced_Topics.html#boost_local.Advanced_Topics.limitations__overloading__operators__etc_">Limitations
(overloading, operators, etc)</a></span></dt>
</dl></div>
@@ -69,23 +69,22 @@
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
- <span class="bold"><strong>Macro parameters with commas</strong></span> which are
- already wrapped by round parenthesis <code class="computeroutput"><span class="special">()</span></code>
- are fine (function calls, etc). However, macro parameters with commas that
- are not wrapped by round parenthesis need to be wrapped by an extra set
- of round parenthesis <code class="computeroutput"><span class="special">()</span></code> as
- described here. Also macro parameters with commas wrapped by angular parenthesis
- <code class="computeroutput"><span class="special"><></span></code> (templates, etc)
- or square parenthesis <code class="computeroutput"><span class="special">[]</span></code> (multidimensional
- array access, etc) need to be wrapped by the extra round parenthesis <code class="computeroutput"><span class="special">()</span></code> as explained here (this is because the
- preprocessor only recognizes the round parenthesis and it does not recognize
- angular, square, or any other type of parenthesis).
+ Macro parameters with commas which are already wrapped by round parenthesis
+ <code class="computeroutput"><span class="special">()</span></code> are fine (function calls,
+ etc). However, macro parameters with commas that are not wrapped by round
+ parenthesis need to be wrapped by an extra set of round parenthesis <code class="computeroutput"><span class="special">()</span></code> as described here. Also macro parameters
+ with commas wrapped by angular parenthesis <code class="computeroutput"><span class="special"><></span></code>
+ (templates, etc) or square parenthesis <code class="computeroutput"><span class="special">[]</span></code>
+ (multidimensional array access, etc) need to be wrapped by the extra round
+ parenthesis <code class="computeroutput"><span class="special">()</span></code> as explained
+ here (this is because the preprocessor only recognizes the round parenthesis
+ and it does not recognize angular, square, or any other type of parenthesis).
</p></td></tr>
</table></div>
<p>
In addition, local function parameter types cannot start with non-alphanumeric
symbols (alphanumeric symbols are <code class="computeroutput"><span class="identifier">A</span><span class="special">-</span><span class="identifier">Z</span></code>, <code class="computeroutput"><span class="identifier">a</span><span class="special">-</span><span class="identifier">z</span></code>,
- and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id881366" href="#ftn.id881366" class="footnote">14</a>]</sup> The library will generate (cryptic) preprocessor errors if a
+ and <code class="computeroutput"><span class="number">0</span><span class="special">-</span><span class="number">9</span></code>). <sup>[<a name="id881360" href="#ftn.id881360" class="footnote">14</a>]</sup> The library will generate (cryptic) preprocessor errors if a
parameter type starts with a non-alphanumeric symbol.
</p>
<p>
@@ -208,7 +207,7 @@
<li class="listitem">
Parenthesis to wrap the type expression (and therefore any commas <code class="computeroutput"><span class="special">,</span></code> that it contains) passed as parameter
to the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
- macro. <sup>[<a name="id882726" href="#ftn.id882726" class="footnote">15</a>]</sup>
+ macro. <sup>[<a name="id882720" href="#ftn.id882720" class="footnote">15</a>]</sup>
</li>
</ol></div>
<p>
@@ -409,7 +408,7 @@
</p></td></tr>
</table></div>
<p>
- Consider the following complete example: <sup>[<a name="id884031" href="#ftn.id884031" class="footnote">16</a>]</sup>
+ Consider the following complete example: <sup>[<a name="id884024" href="#ftn.id884024" class="footnote">16</a>]</sup>
</p>
<div class="informaltable"><table class="table">
<colgroup>
@@ -523,6 +522,251 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Advanced_Topics.passing_local_functions"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.passing_local_functions" title="Passing Local Functions">Passing
+ Local Functions</a>
+</h3></div></div></div>
+<p>
+ Local functions are functors so it is possible to assign them to other functors
+ (like <code class="computeroutput">boost::function</code>)
+ in order to store the local function into a variable or to pass it as a parameter
+ to another function.
+ </p>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/src/images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ When assigning a local function to a functor, programmers need to make
+ sure that the local function survives the scope of the functor otherwise
+ the functor will be invalid and its use will generate a run-time error
+ (as usual with C++ functors).
+ </p></td></tr>
+</table></div>
+<p>
+ For example:
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">void</span> <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">void</span> <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">()</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l2</span><span class="special">;</span>
+
+ <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
+
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">default</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">,</span> <span class="keyword">default</span> <span class="number">2</span><span class="special">,</span>
+ <span class="identifier">bind</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">i</span> <span class="special">*</span> <span class="identifier">y</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">linear</span><span class="special">)</span>
+
+ <span class="comment">// Assign local functions variables.</span>
+ <span class="identifier">l2</span> <span class="special">=</span> <span class="identifier">linear</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="comment">// Similarly, pass local functions as a function parameter.</span>
+ <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
+ <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="keyword">false</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// This wouuld raise run-time error because invalid reference.</span>
+ <span class="special">}</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">void</span> <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">void</span> <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">()</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l2</span><span class="special">;</span>
+
+ <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
+
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)(</span><span class="keyword">default</span> <span class="number">1</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">y</span><span class="special">)(</span><span class="keyword">default</span> <span class="number">2</span><span class="special">)</span>
+ <span class="special">(</span><span class="identifier">bind</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">i</span> <span class="special">*</span> <span class="identifier">y</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">linear</span><span class="special">)</span>
+
+ <span class="comment">// Assign local functions variables.</span>
+ <span class="identifier">l2</span> <span class="special">=</span> <span class="identifier">linear</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="comment">// Similarly, pass local functions as a function parameter.</span>
+ <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
+ <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="keyword">false</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// This would raise run-time error because invalid reference.</span>
+ <span class="special">}</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+<p>
+ In addition, a local function can bind and call another local function. For
+ example, the following local function <code class="computeroutput"><span class="identifier">inc_sum</span></code>
+ binds the local function <code class="computeroutput"><span class="identifier">inc</span></code>
+ so <code class="computeroutput"><span class="identifier">inc_sum</span></code> can call <code class="computeroutput"><span class="identifier">inc</span></code>:
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">offset</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">w</span><span class="special">;</span>
+
+ <span class="comment">// v = 10 20 30 40 50</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">6</span><span class="special">;</span> <span class="identifier">i</span><span class="special">++)</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">i</span> <span class="special">*</span> <span class="number">10</span><span class="special">);</span>
+ <span class="identifier">w</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">());</span>
+
+ <span class="comment">// w = ++v + 5 = 16 26 36 46 56</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Compiler error if const `offset` modified here by mistake.</span>
+ <span class="keyword">return</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">offset</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc</span><span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc</span><span class="special">);</span>
+
+ <span class="identifier">offset</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+
+ <span class="comment">// v = ++(v + w) + 0 = 27 47 67 87 107</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">j</span><span class="special">,</span>
+ <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">inc</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Bind another local function.</span>
+ <span class="keyword">return</span> <span class="identifier">inc</span><span class="special">(</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span><span class="special">);</span> <span class="comment">// Call the bound local function.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc_sum</span><span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc_sum</span><span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
+ <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" "</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span><span class="special">;</span> <span class="special">}</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">offset</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">w</span><span class="special">;</span>
+
+ <span class="comment">// v = 10 20 30 40 50</span>
+ <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">6</span><span class="special">;</span> <span class="identifier">i</span><span class="special">++)</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">i</span> <span class="special">*</span> <span class="number">10</span><span class="special">);</span>
+ <span class="identifier">w</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">());</span>
+
+ <span class="comment">// w = ++v + 5 = 16 26 36 46 56</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="comment">// Compiler error if const `offset` modified here by mistake.</span>
+ <span class="keyword">return</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">offset</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc</span><span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc</span><span class="special">);</span>
+
+ <span class="identifier">offset</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
+
+ <span class="comment">// v = ++(v + w) + 0 = 27 47 67 87 107</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">j</span><span class="special">)</span>
+ <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">inc</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span> <span class="comment">// Bind another local function.</span>
+ <span class="keyword">return</span> <span class="identifier">inc</span><span class="special">(</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span><span class="special">);</span> <span class="comment">// Call the bound local function.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc_sum</span><span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc_sum</span><span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
+ <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" "</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span><span class="special">;</span> <span class="special">}</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Advanced_Topics.deducing_bound_types__concepts__etc_"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.deducing_bound_types__concepts__etc_" title="Deducing Bound Types (concepts, etc)">Deducing
Bound Types (concepts, etc)</a>
</h3></div></div></div>
@@ -851,336 +1095,13 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced_Topics.passing_local_functions"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.passing_local_functions" title="Passing Local Functions">Passing
- Local Functions</a>
+<a name="boost_local.Advanced_Topics.exception_specifications"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.exception_specifications" title="Exception Specifications">Exception
+ Specifications</a>
</h3></div></div></div>
<p>
- Local functions can be used as functors. For example, it is possible to assign
- a local function to a functor parameter (using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span></code>,
- etc) in order to pass the local function to another function. However, it
- is in general recommended to use the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code>
- functor because it supports default parameters.
- </p>
-<div class="important"><table border="0" summary="Important">
-<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/src/images/important.png"></td>
-<th align="left">Important</th>
-</tr>
-<tr><td align="left" valign="top"><p>
- When assigning a local function to a functor, programmers need to make
- sure that the <span class="bold"><strong>local function survives the scope of
- the functor</strong></span> otherwise the functor will be invalid and its use
- will generate a run-time error (as usual with C++ functors).
- </p></td></tr>
-</table></div>
-<p>
- The <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code> template takes two
- parameters (see the Reference section):
- </p>
-<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">defaults</span> <span class="special">=</span> <span class="number">0</span><span class="special">></span> <span class="keyword">class</span> <code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special">;</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">F</span></dt>
-<dd>
-<p>
- The template parameter <code class="computeroutput"><span class="identifier">F</span></code>
- is a function type specifying the function signature using the same
- syntax as Boost.Function's
- preferred syntax. For example:
-</p>
-<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">()></span> <span class="comment">// Returns `int` and takes no parameter.</span>
-<code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">)></span> <span class="comment">// Returns `int`and takes two parameters: a `double` followed by a `char`.</span>
-</pre>
-<p>
- </p>
-</dd>
-<dt><span class="term">defaults</span></dt>
-<dd>
-<p>
- The template parameter <code class="computeroutput"><span class="identifier">defaults</span></code>
- is a non-negative integer number specifying the number of defaults
- parameters (counting from the last parameter as usual): <code class="computeroutput"><span class="number">0</span></code> if no parameter is optional, <code class="computeroutput"><span class="number">1</span></code> if the last parameter is optional,
- <code class="computeroutput"><span class="number">2</span></code> if the last two parameters
- are optional, etc. The <code class="computeroutput"><span class="identifier">defaults</span></code>
- template parameter must be between <code class="computeroutput"><span class="number">0</span></code>
- and the total number of parameters as specified by <code class="computeroutput"><span class="identifier">F</span></code>,
- it is optional and it is <code class="computeroutput"><span class="number">0</span></code>
- by default. For example:
-</p>
-<pre class="programlisting"><code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">)></span> <span class="comment">// No default: All parameters must be specified.</span>
-<code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">),</span> <span class="number">1</span><span class="special">></span> <span class="comment">// 1 default: The last `char` parameter is optional.</span>
-<code class="computeroutput"><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code><span class="special"><</span><span class="keyword">int</span><span class="special">(</span><span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">),</span> <span class="number">2</span><span class="special">></span> <span class="comment">// 2 defaults: All parameters are optional.</span>
-</pre>
-<p>
- </p>
-</dd>
-</dl>
-</div>
-<p>
- For example:
- </p>
-<div class="informaltable"><table class="table">
-<colgroup>
-<col>
-<col>
-</colgroup>
-<thead><tr>
-<th>
- <p>
- Variadic Macro Syntax (C99 and later compilers)
- </p>
- </th>
-<th>
- <p>
- Sequencing Macro Syntax (all C++ compilers)
- </p>
- </th>
-</tr></thead>
-<tbody><tr>
-<td>
- <p>
-
-</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
-
-<span class="comment">// Using `function` allows to use the same functor for all calls (regardless of</span>
-<span class="comment">// which set of default parameters is specified).</span>
-<span class="keyword">void</span> <span class="identifier">doit</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">),</span> <span class="number">2</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
-<span class="special">}</span>
-
-<span class="comment">// Using `function` requires different functors for calls with different set of</span>
-<span class="comment">// default parameters.</span>
-<span class="keyword">void</span> <span class="identifier">doit2</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span>
- <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
-<span class="keyword">void</span> <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
-<span class="keyword">void</span> <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">()</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
-
-<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)></span> <span class="identifier">l2</span><span class="special">;</span>
-
- <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
-
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">default</span> <span class="number">1</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">,</span> <span class="keyword">default</span> <span class="number">2</span><span class="special">,</span>
- <span class="identifier">bind</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">i</span> <span class="special">*</span> <span class="identifier">y</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">linear</span><span class="special">)</span>
-
- <span class="comment">// Assign local functions variables.</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">),</span> <span class="number">2</span> <span class="special">></span> <span class="identifier">l</span> <span class="special">=</span> <span class="identifier">linear</span><span class="special">;</span>
- <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="identifier">l</span><span class="special">();</span> <span class="comment">// All calls because of default parameters.</span>
- <span class="identifier">l2</span> <span class="special">=</span> <span class="identifier">linear</span><span class="special">;</span>
- <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// Only one call operation (without default parameters).</span>
-
- <span class="comment">// Similarly, pass local functions as a function parameter.</span>
- <span class="identifier">doit</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="identifier">doit2</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="special">}</span>
-
- <span class="keyword">if</span> <span class="special">(</span><span class="keyword">false</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// This wouuld raise run-time error because invalid reference.</span>
- <span class="special">}</span>
-
- <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
- </td>
-<td>
- <p>
-
-</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
-
-<span class="comment">// Using `function` allows to use the same functor for all calls (regardless of</span>
-<span class="comment">// which set of default parameters is specified).</span>
-<span class="keyword">void</span> <span class="identifier">doit</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">),</span> <span class="number">2</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
-<span class="special">}</span>
-
-<span class="comment">// Using `function` requires different functors for calls with different set of</span>
-<span class="comment">// default parameters.</span>
-<span class="keyword">void</span> <span class="identifier">doit2</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span>
- <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
-<span class="keyword">void</span> <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
-<span class="keyword">void</span> <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">()</span> <span class="special">></span> <span class="identifier">l</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">l</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span>
-
-<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span><span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)></span> <span class="identifier">l2</span><span class="special">;</span>
-
- <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
-
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)(</span><span class="keyword">default</span> <span class="number">1</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">y</span><span class="special">)(</span><span class="keyword">default</span> <span class="number">2</span><span class="special">)</span>
- <span class="special">(</span><span class="identifier">bind</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">i</span> <span class="special">*</span> <span class="identifier">y</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">linear</span><span class="special">)</span>
-
- <span class="comment">// Assign local functions variables.</span>
- <span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">),</span> <span class="number">2</span> <span class="special">></span> <span class="identifier">l</span> <span class="special">=</span> <span class="identifier">linear</span><span class="special">;</span>
- <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="identifier">l</span><span class="special">(</span><span class="number">1</span><span class="special">);</span> <span class="identifier">l</span><span class="special">();</span> <span class="comment">// All calls because of default parameters.</span>
- <span class="identifier">l2</span> <span class="special">=</span> <span class="identifier">linear</span><span class="special">;</span>
- <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// Only one call operation (without default parameters).</span>
-
- <span class="comment">// Similarly, pass local functions as a function parameter.</span>
- <span class="identifier">doit</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
- <span class="identifier">doit2</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="identifier">doit1</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="identifier">doit0</span><span class="special">(</span><span class="identifier">linear</span><span class="special">);</span>
- <span class="special">}</span>
-
- <span class="keyword">if</span> <span class="special">(</span><span class="keyword">false</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">l2</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span> <span class="comment">// This wouuld raise run-time error because invalid reference.</span>
- <span class="special">}</span>
-
- <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
- </td>
-</tr></tbody>
-</table></div>
-<p>
- In addition, a local function can bind and call another local function. For
- example, the following local function <code class="computeroutput"><span class="identifier">inc_sum</span></code>
- binds the local function <code class="computeroutput"><span class="identifier">inc</span></code>
- so <code class="computeroutput"><span class="identifier">inc_sum</span></code> can call <code class="computeroutput"><span class="identifier">inc</span></code>:
- </p>
-<div class="informaltable"><table class="table">
-<colgroup>
-<col>
-<col>
-</colgroup>
-<thead><tr>
-<th>
- <p>
- Variadic Macro Syntax (C99 and later compilers)
- </p>
- </th>
-<th>
- <p>
- Sequencing Macro Syntax (all C++ compilers)
- </p>
- </th>
-</tr></thead>
-<tbody><tr>
-<td>
- <p>
-
-</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
-
-<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">offset</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">w</span><span class="special">;</span>
-
- <span class="comment">// v = 10 20 30 40 50</span>
- <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">6</span><span class="special">;</span> <span class="identifier">i</span><span class="special">++)</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">i</span> <span class="special">*</span> <span class="number">10</span><span class="special">);</span>
- <span class="identifier">w</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">());</span>
-
- <span class="comment">// w = ++v + 5 = 16 26 36 46 56</span>
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">{</span>
- <span class="comment">// Compiler error if const `offset` modified here by mistake.</span>
- <span class="keyword">return</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">offset</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc</span><span class="special">);</span>
-
- <span class="identifier">offset</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
-
- <span class="comment">// v = ++(v + w) + 0 = 27 47 67 87 107</span>
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">j</span><span class="special">,</span>
- <span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">inc</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Bind another local function.</span>
- <span class="keyword">return</span> <span class="identifier">inc</span><span class="special">(</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span><span class="special">);</span> <span class="comment">// Call the bound local function.</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc_sum</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc_sum</span><span class="special">);</span>
-
- <span class="keyword">for</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" "</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span><span class="special">;</span> <span class="special">}</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
-
- <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
- </td>
-<td>
- <p>
-
-</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">algorithm</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">vector</span><span class="special">></span>
-
-<span class="keyword">int</span> <span class="identifier">main</span> <span class="special">()</span> <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">offset</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">v</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">></span> <span class="identifier">w</span><span class="special">;</span>
-
- <span class="comment">// v = 10 20 30 40 50</span>
- <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">6</span><span class="special">;</span> <span class="identifier">i</span><span class="special">++)</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">i</span> <span class="special">*</span> <span class="number">10</span><span class="special">);</span>
- <span class="identifier">w</span><span class="special">.</span><span class="identifier">resize</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">());</span>
-
- <span class="comment">// w = ++v + 5 = 16 26 36 46 56</span>
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="comment">// Compiler error if const `offset` modified here by mistake.</span>
- <span class="keyword">return</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">offset</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc</span><span class="special">);</span>
-
- <span class="identifier">offset</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
-
- <span class="comment">// v = ++(v + w) + 0 = 27 47 67 87 107</span>
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">j</span><span class="special">)</span>
- <span class="special">(</span><span class="keyword">const</span> <span class="identifier">bind</span><span class="special">&</span> <span class="identifier">inc</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span> <span class="comment">// Bind another local function.</span>
- <span class="keyword">return</span> <span class="identifier">inc</span><span class="special">(</span><span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span><span class="special">);</span> <span class="comment">// Call the bound local function.</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">inc_sum</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">transform</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">w</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">inc_sum</span><span class="special">);</span>
-
- <span class="keyword">for</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">" "</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span><span class="special">;</span> <span class="special">}</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
-
- <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
- </td>
-</tr></tbody>
-</table></div>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced_Topics.exception_specifications"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.exception_specifications" title="Exception Specifications">Exception
- Specifications</a>
-</h3></div></div></div>
-<p>
- It is possible to program exception specifications for local functions, local
- blocks, and local exits. Exception specifications are programmed outside
- the macros and just before the body definition as usual in C++.
+ It is possible to program exception specifications for local functions, local
+ blocks, and local exits. Exception specifications are programmed outside
+ the macros and just before the body definition as usual in C++.
</p>
<div class="important"><table border="0" summary="Important">
<tr>
@@ -1306,88 +1227,6 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_local.Advanced_Topics.storage_classifiers___auto__and__register__"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.storage_classifiers___auto__and__register__" title="Storage Classifiers (auto and register)">Storage
- Classifiers (<code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code>)</a>
-</h3></div></div></div>
-<p>
- Local function parameters support the storage classifiers as usual in C++.
- The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
- is specified as:
- </p>
-<pre class="programlisting"><span class="keyword">auto</span> <span class="emphasis"><em>parameter-type parameter-name</em></span>
-</pre>
-<p>
- and the <code class="computeroutput"><span class="keyword">register</span></code> storage classifier
- is specified as:
- </p>
-<pre class="programlisting"><span class="keyword">register</span> <span class="emphasis"><em>parameter-type parameter-name</em></span>
-</pre>
-<p>
- For example:
- </p>
-<div class="informaltable"><table class="table">
-<colgroup>
-<col>
-<col>
-</colgroup>
-<thead><tr>
-<th>
- <p>
- Variadic Macro Syntax (C99 and later compilers)
- </p>
- </th>
-<th>
- <p>
- Sequencing Macro Syntax (all C++ compilers)
- </p>
- </th>
-</tr></thead>
-<tbody><tr>
-<td>
- <p>
-
-</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
-
-<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">auto</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
-
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="number">3</span><span class="special">,</span> <span class="number">5</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
-
- <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
- </td>
-<td>
- <p>
-
-</p>
-<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
-
-<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
- <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">auto</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">(</span><span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
- <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
- <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
-
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="number">3</span><span class="special">,</span> <span class="number">5</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
-
- <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
-<span class="special">}</span>
-</pre>
-<p>
- </p>
- </td>
-</tr></tbody>
-</table></div>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Advanced_Topics.inlined_local_functions"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.inlined_local_functions" title="Inlined Local Functions">Inlined
Local Functions</a>
</h3></div></div></div>
@@ -1413,8 +1252,8 @@
inlined local functions always have a run-time comparable to their equivalent
implementations that use local functor classes (see the <a class="link" href="Alternatives.html" title="Appendix: Alternatives">Alternatives</a>
section). However, inlined local functions have the limitation that they
- cannot be assigned to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><a class="link" href="../boost/local/function.html" title="Struct template function">function</a></code>
- and they cannot be passed as template parameters <sup>[<a name="id904750" href="#ftn.id904750" class="footnote">17</a>]</sup>.
+ cannot be assigned to other functors (like <code class="computeroutput">boost::function</code>)
+ and they cannot be passed as template parameters <sup>[<a name="id901740" href="#ftn.id901740" class="footnote">17</a>]</sup>.
</p>
<p>
On C++0x compilers, <code class="computeroutput"><span class="keyword">inline</span></code>
@@ -1793,6 +1632,88 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
+<a name="boost_local.Advanced_Topics.storage_classifiers___auto__and__register__"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.storage_classifiers___auto__and__register__" title="Storage Classifiers (auto and register)">Storage
+ Classifiers (<code class="computeroutput"><span class="keyword">auto</span></code> and <code class="computeroutput"><span class="keyword">register</span></code>)</a>
+</h3></div></div></div>
+<p>
+ Local function parameters support the storage classifiers as usual in C++.
+ The <code class="computeroutput"><span class="keyword">auto</span></code> storage classifier
+ is specified as:
+ </p>
+<pre class="programlisting"><span class="keyword">auto</span> <span class="emphasis"><em>parameter-type parameter-name</em></span>
+</pre>
+<p>
+ and the <code class="computeroutput"><span class="keyword">register</span></code> storage classifier
+ is specified as:
+ </p>
+<pre class="programlisting"><span class="keyword">register</span> <span class="emphasis"><em>parameter-type parameter-name</em></span>
+</pre>
+<p>
+ For example:
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Variadic Macro Syntax (C99 and later compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Sequencing Macro Syntax (all C++ compilers)
+ </p>
+ </th>
+</tr></thead>
+<tbody><tr>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span><span class="keyword">auto</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="number">3</span><span class="special">,</span> <span class="number">5</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
+
+<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">int</span> <span class="identifier">BOOST_LOCAL_FUNCTION_PARAMS</span><span class="special">(</span> <span class="special">(</span><span class="keyword">auto</span> <span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">(</span><span class="keyword">register</span> <span class="keyword">int</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span><span class="special">;</span>
+ <span class="special">}</span> <span class="identifier">BOOST_LOCAL_FUNCTION_NAME</span><span class="special">(</span><span class="identifier">add</span><span class="special">)</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="number">3</span><span class="special">,</span> <span class="number">5</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_"></a><a class="link" href="Advanced_Topics.html#boost_local.Advanced_Topics.limitations__overloading__operators__etc_" title="Limitations (overloading, operators, etc)">Limitations
(overloading, operators, etc)</a>
</h3></div></div></div>
@@ -1856,7 +1777,8 @@
<td>
<p>
This is not supported because local functions are implemented using
- local classes and C++ local classes cannot be templates.
+ local classes and ISO C++ local classes cannot be templates (see
+ [2657]).
</p>
</td>
</tr>
@@ -1885,14 +1807,16 @@
</td>
<td>
<p>
- No
+ Yes
</p>
</td>
<td>
<p>
- Local functions are always defined together with their declarations
- so they are always inlined and there is no need to specify them
- <code class="computeroutput"><span class="keyword">inline</span></code>.
+ Local functions can be specified <code class="computeroutput"><span class="keyword">inline</span></code>
+ to improve the chances that ISO C++ standard compilers can optimize
+ their run-time (but <code class="computeroutput"><span class="keyword">inline</span></code>
+ local functions cannot be passes as template parameters on ISO
+ C++ standard compilers).
</p>
</td>
</tr>
@@ -1945,17 +1869,7 @@
<td>
<p>
This is not supported because local functions are not member functions.
- </p>
- <p>
- In theory, it would be possible for a local functor class to inherit
- from another local functor class. The parenthesized syntax could
- be extended to specify the eventual base local functor class within
- the parenthesized signature (e.g., using <code class="computeroutput"><span class="special">...</span>
- <span class="special">(</span><span class="identifier">extends</span><span class="special">)(</span></code><span class="emphasis"><em>base</em></span><code class="computeroutput"><span class="special">)</span></code>). However, this "inheritance"
- feature is not implemented because it seems of <a href="http://lists.boost.org/Archives/boost/2010/09/170895.php" target="_top">no
- use</a> given that local functions can be bound to one another
- thus they can simply call each other directly without recurring
- to dynamic binding or base function call.
+ <sup>[<a name="id909393" href="#ftn.id909393" class="footnote">a</a>]</sup>
</p>
</td>
</tr>
@@ -1990,10 +1904,9 @@
</td>
<td>
<p>
- This is supported but it cannot be overloaded and it cannot be
- an operator (see the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a>
- and <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced Topics</a>
- sections).
+ Local functions are named and they can call themselves recursively
+ but they cannot be overloaded and they cannot be operators (see
+ the <a class="link" href="Tutorial.html" title="Tutorial">Tutorial</a> and <a class="link" href="Advanced_Topics.html" title="Advanced Topics">Advanced Topics</a> sections).
</p>
</td>
</tr>
@@ -2055,6 +1968,18 @@
</td>
</tr>
</tbody>
+<tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a id="ftn.id909393" href="#id909393" class="para">a</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> In theory, it would
+ be possible for a local functor class to inherit from another
+ local functor class. The parenthesized syntax could be extended
+ to specify the eventual base local functor class within the parenthesized
+ signature (e.g., using <code class="computeroutput"><span class="special">...</span>
+ <span class="special">(</span><span class="identifier">extends</span><span class="special">)(</span></code><span class="emphasis"><em>base</em></span><code class="computeroutput"><span class="special">)</span></code>). However, this "inheritance"
+ feature is not implemented because it seems of <a href="http://lists.boost.org/Archives/boost/2010/09/170895.php" target="_top">no
+ use</a> given that local functions can be bound to one another
+ thus they can simply call each other directly without recurring
+ to dynamic binding or base function call.
+ </p></div></td></tr></tbody>
</table></div>
<a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_.overloading"></a><h6>
<a name="boost_local.Advanced_Topics.limitations__overloading__operators__etc_.overloading-heading"></a>
@@ -2064,7 +1989,7 @@
It is not possible to overload local functions. Declaring multiple local
functions with the same name within the same enclosing scope generates a
compile-time error (even if the different declarations specify different
- parameters). <sup>[<a name="id911887" href="#ftn.id911887" class="footnote">18</a>]</sup>
+ parameters). <sup>[<a name="id909774" href="#ftn.id909774" class="footnote">18</a>]</sup>
</p>
<p>
For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -2088,7 +2013,7 @@
</h6>
<p>
Local functions cannot be operators. Naming a local function <code class="computeroutput"><span class="keyword">operator</span><span class="special">...</span></code>
- will generate a compile-time error. <sup>[<a name="id912235" href="#ftn.id912235" class="footnote">19</a>]</sup>
+ will generate a compile-time error. <sup>[<a name="id910124" href="#ftn.id910124" class="footnote">19</a>]</sup>
</p>
<p>
For example, the following code will <span class="bold"><strong>not</strong></span>
@@ -2135,21 +2060,21 @@
</div>
<div class="footnotes">
<br><hr width="100" align="left">
-<div class="footnote"><p><sup>[<a id="ftn.id881366" href="#id881366" class="para">14</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id881360" href="#id881360" class="para">14</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This limitation derives from
the fact that <code class="computeroutput"><a class="link" href="../BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a></code>
uses preprocessor token concatenation to inspect the parameter type token
to see if the token is a parameter or a bound variable. The C++ preprocessor
does not allow to concatenate non-alphanumeric tokens.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id882726" href="#id882726" class="para">15</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id882720" href="#id882720" class="para">15</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> Using variadic macros,
this extra set of parenthesis could be eliminated requiring only the
parenthesis to invoke the <code class="computeroutput"><a class="link" href="../BOOST_IDENTITY_TYPE.html" title="Macro BOOST_IDENTITY_TYPE">BOOST_IDENTITY_TYPE</a></code>
macro. However, this feature is currently not implemented and the double
parenthesis are always needed when invoking this macro.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id884031" href="#id884031" class="para">16</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id884024" href="#id884024" class="para">16</a>] </sup>
The authors recognize that the use of the <span class="emphasis"><em>identity macros</em></span>
adds extra parenthesis to the already significant number of parenthesis
required by the sequencing macro syntax. However, macro parameters usually
@@ -2157,7 +2082,7 @@
(unless template metaprogramming is being used) so this is usually not
a problem.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id904750" href="#id904750" class="para">17</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id901740" href="#id901740" class="para">17</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This library uses an indirect
function call via a function pointer in order to pass the local function
as a template parameter (see the <a class="link" href="Implementation.html" title="Appendix: Implementation">Implementation</a>
@@ -2171,14 +2096,14 @@
be inlined on C++0x compilers (even when the local function is not declared
inlined).
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id911887" href="#id911887" class="para">18</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id909774" href="#id909774" class="para">18</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This is because a local function
is a functor object declared as a local variable within the enclosing scope.
Therefore, declaring two local functions with the same name within the
same enclosing scope declares two local variables with the same name within
the same scope and that is not allowed in C++.
</p></div>
-<div class="footnote"><p><sup>[<a id="ftn.id912235" href="#id912235" class="para">19</a>] </sup>
+<div class="footnote"><p><sup>[<a id="ftn.id910124" href="#id910124" class="para">19</a>] </sup>
<span class="bold"><strong>Rationale.</strong></span> This is the because a local
function name must be a valid local variable name (the local variable to
hold the local functor object) and operators cannot be used as local variable
Modified: sandbox/local/libs/local/doc/html/boost_local/Examples.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Examples.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Examples.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -877,9 +877,9 @@
</p>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)></span> <span class="identifier">store_func</span><span class="special">,</span>
- <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
+<span class="keyword">void</span> <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">void</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">store_func</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
<span class="identifier">store_func</span><span class="special">(</span><span class="identifier">size</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="special">-</span><span class="number">1</span><span class="special">);</span>
<span class="special">}</span>
@@ -903,9 +903,9 @@
</p>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">local</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">function</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">local</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)></span> <span class="identifier">store_func</span><span class="special">,</span>
- <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
+<span class="keyword">void</span> <span class="identifier">intermediate</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function</span><span class="special"><</span> <span class="keyword">void</span> <span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">int</span><span class="special">)</span> <span class="special">></span> <span class="identifier">store_func</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">size</span><span class="special">)</span> <span class="special">{</span>
<span class="identifier">store_func</span><span class="special">(</span><span class="identifier">size</span> <span class="special">-</span> <span class="number">1</span><span class="special">,</span> <span class="special">-</span><span class="number">1</span><span class="special">);</span>
<span class="special">}</span>
Modified: sandbox/local/libs/local/doc/html/boost_local/Implementation.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Implementation.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Implementation.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -254,31 +254,30 @@
<span class="keyword">struct</span> <span class="identifier">casting_func</span> <span class="special">{</span>
<span class="keyword">explicit</span> <span class="identifier">casting_func</span><span class="special">(</span><span class="keyword">void</span><span class="special">*</span> <span class="identifier">obj</span><span class="special">,</span> <span class="keyword">void</span> <span class="special">(*</span><span class="identifier">call</span><span class="special">)(</span><span class="keyword">void</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">double</span><span class="special">&)):</span>
<span class="identifier">obj_</span><span class="special">(</span><span class="identifier">obj</span><span class="special">),</span> <span class="identifier">call_</span><span class="special">(</span><span class="identifier">call</span><span class="special">)</span> <span class="special">{}</span>
- <span class="keyword">inline</span> <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">num</span><span class="special">)</span>
- <span class="special">{</span> <span class="identifier">call_</span><span class="special">(</span><span class="identifier">obj_</span><span class="special">,</span> <span class="identifier">num</span><span class="special">);</span> <span class="special">}</span> <span class="comment">// function pointer call cannot be inlined</span>
+ <span class="comment">// Unfortunately, function pointer call is not inlined.</span>
+ <span class="keyword">inline</span> <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">num</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">call_</span><span class="special">(</span><span class="identifier">obj_</span><span class="special">,</span> <span class="identifier">num</span><span class="special">);</span> <span class="special">}</span>
<span class="keyword">private</span><span class="special">:</span>
<span class="keyword">void</span><span class="special">*</span> <span class="identifier">obj_</span><span class="special">;</span>
<span class="keyword">void</span> <span class="special">(*</span><span class="identifier">call_</span><span class="special">)(</span><span class="keyword">void</span><span class="special">*,</span> <span class="keyword">const</span> <span class="keyword">double</span><span class="special">&);</span>
<span class="special">};</span>
<span class="comment">// Virtual Functor Trick</span>
-<span class="keyword">struct</span> <span class="identifier">func_interface</span> <span class="special">{</span>
- <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&)</span>
- <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="comment">// virtual call cannot be inlined</span>
-<span class="special">};</span>
<span class="keyword">struct</span> <span class="identifier">virtual_func</span> <span class="special">{</span>
- <span class="keyword">explicit</span> <span class="identifier">virtual_func</span><span class="special">(</span><span class="identifier">func_interface</span><span class="special">&</span> <span class="identifier">func</span><span class="special">):</span> <span class="identifier">func_</span><span class="special">(&</span><span class="identifier">func</span><span class="special">)</span> <span class="special">{}</span>
- <span class="keyword">inline</span> <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">num</span><span class="special">)</span>
- <span class="special">{</span> <span class="special">(*</span><span class="identifier">func_</span><span class="special">)(</span><span class="identifier">num</span><span class="special">);</span> <span class="special">}</span>
+ <span class="keyword">struct</span> <span class="identifier">interface</span> <span class="special">{</span>
+ <span class="comment">// Unfortunately, virtual function call is not inlined.</span>
+ <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&)</span> <span class="special">{}</span>
+ <span class="special">};</span>
+ <span class="keyword">explicit</span> <span class="identifier">virtual_func</span><span class="special">(</span><span class="identifier">interface</span><span class="special">&</span> <span class="identifier">func</span><span class="special">):</span> <span class="identifier">func_</span><span class="special">(&</span><span class="identifier">func</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="keyword">inline</span> <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">num</span><span class="special">)</span> <span class="special">{</span> <span class="special">(*</span><span class="identifier">func_</span><span class="special">)(</span><span class="identifier">num</span><span class="special">);</span> <span class="special">}</span>
<span class="keyword">private</span><span class="special">:</span>
- <span class="identifier">func_interface</span><span class="special">*</span> <span class="identifier">func_</span><span class="special">;</span>
+ <span class="identifier">interface</span><span class="special">*</span> <span class="identifier">func_</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span>
<span class="keyword">double</span> <span class="identifier">sum</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">;</span>
<span class="keyword">int</span> <span class="identifier">factor</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
- <span class="keyword">struct</span> <span class="identifier">local_add</span> <span class="special">:</span> <span class="identifier">func_interface</span> <span class="special">{</span>
+ <span class="keyword">struct</span> <span class="identifier">local_add</span> <span class="special">:</span> <span class="identifier">virtual_func</span><span class="special">::</span><span class="identifier">interface</span> <span class="special">{</span>
<span class="keyword">explicit</span> <span class="identifier">local_add</span><span class="special">(</span><span class="keyword">double</span><span class="special">&</span> <span class="identifier">_sum</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">int</span><span class="special">&</span> <span class="identifier">_factor</span><span class="special">):</span>
<span class="identifier">sum_</span><span class="special">(</span><span class="identifier">_sum</span><span class="special">),</span> <span class="identifier">factor_</span><span class="special">(</span><span class="identifier">_factor</span><span class="special">)</span> <span class="special">{}</span>
<span class="keyword">inline</span> <span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="keyword">double</span><span class="special">&</span> <span class="identifier">num</span><span class="special">)</span> <span class="special">{</span>
@@ -302,7 +301,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">v</span><span class="special">(</span><span class="number">10</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">fill</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="number">1.0</span><span class="special">);</span>
-<span class="comment">// std::for_each(v.begin(), v.end(), add_local); // Error but OK on C++03.</span>
+<span class="comment">// std::for_each(v.begin(), v.end(), add_local); // Error but OK on C++0x.</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">add_casting</span><span class="special">);</span> <span class="comment">// OK.</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">add_virtual</span><span class="special">);</span> <span class="comment">// OK.</span>
Modified: sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html
==============================================================================
--- sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html (original)
+++ sandbox/local/libs/local/doc/html/boost_local/Release_Notes.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -68,9 +68,21 @@
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_local.Release_Notes.todo"></a><a class="link" href="Release_Notes.html#boost_local.Release_Notes.todo" title="TODO">TODO</a>
</h3></div></div></div>
-<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ Remove all references (docs, doxy, examples, etc) to local::function.
+ Make local::function local::aux::function and use boost::function instead.
+ </li>
+<li class="listitem">
+ Verify compilation and run-times on all compilers one last time.
+ </li>
+<li class="listitem">
Rework factorial_impl and Implementation section.
- </li></ol></div>
+ </li>
+<li class="listitem">
+ Finalize Acknowledge section.
+ </li>
+</ol></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/local/libs/local/doc/html/index.html
==============================================================================
--- sandbox/local/libs/local/doc/html/index.html (original)
+++ sandbox/local/libs/local/doc/html/index.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -23,7 +23,7 @@
<div><h2 class="title">
<a name="boost_local"></a>Boost.Local 0.2.0 </h2></div>
<div><div class="authorgroup"><div class="author"><h3 class="author">
-<span class="firstname">Lorenzo</span> <span class="surname">Caminiti (lorcaminiti_at_[hidden])</span>
+<span class="firstname">Lorenzo</span> <span class="surname">Caminiti (lorcaminiti -at- gmail.com)</span>
</h3></div></div></div>
<div><p class="copyright">Copyright © 2009-2011 Lorenzo Caminiti</p></div>
<div><div class="legalnotice">
@@ -416,7 +416,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: May 02, 2011 at 21:49:36 GMT</small></p></td>
+<td align="left"><p><small>Last revised: May 03, 2011 at 23:52:20 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/local/libs/local/doc/html/reference.html
==============================================================================
--- sandbox/local/libs/local/doc/html/reference.html (original)
+++ sandbox/local/libs/local/doc/html/reference.html 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -72,11 +72,6 @@
<a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS">BOOST_LOCAL_FUNCTION_PARAMS</a>(parameters)
<a class="link" href="BOOST_LOCAL_FUNCTION_PARAMS_TPL.html" title="Macro BOOST_LOCAL_FUNCTION_PARAMS_TPL">BOOST_LOCAL_FUNCTION_PARAMS_TPL</a>(parameters)
<a class="link" href="BOOST_LOCAL_FUNCTION_NAME.html" title="Macro BOOST_LOCAL_FUNCTION_NAME">BOOST_LOCAL_FUNCTION_NAME</a>(name)</pre>
-<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
- <span class="keyword">namespace</span> <span class="identifier">local</span> <span class="special">{</span>
- <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">,</span> <span class="identifier">size_t</span> defaults <span class="special">=</span> <span class="number">0</span><span class="special">></span> <span class="keyword">struct</span> <a class="link" href="boost/local/function.html" title="Struct template function">function</a><span class="special">;</span>
- <span class="special">}</span>
-<span class="special">}</span></pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
Modified: sandbox/local/libs/local/doc/html/standalone_HTML.manifest
==============================================================================
--- sandbox/local/libs/local/doc/html/standalone_HTML.manifest (original)
+++ sandbox/local/libs/local/doc/html/standalone_HTML.manifest 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -12,7 +12,6 @@
BOOST_LOCAL_EXIT.html
BOOST_LOCAL_EXIT_TPL.html
BOOST_LOCAL_EXIT_END.html
-boost/local/function.html
BOOST_LOCAL_FUNCTION_PARAMS.html
BOOST_LOCAL_FUNCTION_PARAMS_TPL.html
BOOST_LOCAL_FUNCTION_NAME.html
Modified: sandbox/local/libs/local/doc/qbk/advanced_topics.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/advanced_topics.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/advanced_topics.qbk 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -15,7 +15,7 @@
Therefore, using commas within the local function parameters and bindings will generate (cryptic) preprocessor errors unless they are wrapped within extra round parenthesis `()` as explained here.
[note
-*Macro parameters with commas* which are already wrapped by round parenthesis `()` are fine (function calls, etc).
+Macro parameters with commas which are already wrapped by round parenthesis `()` are fine (function calls, etc).
However, macro parameters with commas that are not wrapped by round parenthesis need to be wrapped by an extra set of round parenthesis `()` as described here.
Also macro parameters with commas wrapped by angular parenthesis `<>` (templates, etc) or square parenthesis `[]` (multidimensional array access, etc) need to be wrapped by the extra round parenthesis `()` as explained here (this is because the preprocessor only recognizes the round parenthesis and it does not recognize angular, square, or any other type of parenthesis).
]
@@ -170,90 +170,68 @@
[endsect]
-[section Deducing Bound Types (concepts, etc)]
-
-While the ISO C++ standard does not allow for member functions of local classes to have template parameters, this library allows to call template functions from within a local function, a local block, or a local exit passing bound variables without explicitly specifying their types.
-This essentially allows local functions, local blocks, and local exits to be [@http://en.wikipedia.org/wiki/Type_polymorphism polymorphic] in the type of the bound variables (like a template is polymorphic in the type of its template parameters).
-
-Furthermore, this library allow to access the type of the bound variables from within the local function, local block, or local exit using the following macro:
-
- #include <boost/local/typeof.hpp>
+[section Passing Local Functions]
- ... // Within a local function, local block, or local exit.
- __BOOST_LOCAL_TYPEOF__(``/bound-variable/``) ...
- ...
+Local functions are functors so it is possible to assign them to other functors (like `__boost__function__`) in order to store the local function into a variable or to pass it as a parameter to another function.
-This macro expands to a type expression that evaluates (at compile-time) to the fully qualified type of the specified bound variable.
-
-[note
-This type expression is fully qualified in the sense that it will be constant if the variable is bound by constant and it will also be a reference is the variable is bound by reference (if needed, programmers can strip away the `const` and `&` qualifiers using `boost::remove_const` and `boost::remove_reference`, or similar template metafunctions).
+[important
+When assigning a local function to a functor, programmers need to make sure that the local function survives the scope of the functor otherwise the functor will be invalid and its use will generate a run-time error (as usual with C++ functors).
]
-The deduced bound type can be used within the body to declare a local variable, to check concepts, etc.
For example:
[table
[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
-[ [ [typeof_va_cpp] ] [ [typeof_cpp] ] ]
+[ [ [doit_va_cpp] ] [ [doit_cpp] ] ]
]
-Within templates, `__BOOST_LOCAL_TYPEOF__` does not require to be prefixed by the `typename` keyword but eventual type manipulations need the `typename` prefix as usual:
+In addition, a local function can bind and call another local function.
+For example, the following local function `inc_sum` binds the local function `inc` so `inc_sum` can call `inc`:
[table
[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
-[ [ [typeof_tpl_va_cpp] ] [ [typeof_tpl_cpp] ] ]
+[ [ [transform_va_cpp] ] [ [transform_cpp] ] ]
]
[endsect]
-[section Passing Local Functions]
+[section Deducing Bound Types (concepts, etc)]
-Local functions can be used as functors.
-For example, it is possible to assign a local function to a functor parameter (using `boost::function`, etc) in order to pass the local function to another function.
-However, it is in general recommended to use the `boost::local::__function__` functor because it supports default parameters.
+While the ISO C++ standard does not allow for member functions of local classes to have template parameters, this library allows to call template functions from within a local function, a local block, or a local exit passing bound variables without explicitly specifying their types.
+This essentially allows local functions, local blocks, and local exits to be [@http://en.wikipedia.org/wiki/Type_polymorphism polymorphic] in the type of the bound variables (like a template is polymorphic in the type of its template parameters).
-[important
-When assigning a local function to a functor, programmers need to make sure that the *local function survives the scope of the functor* otherwise the functor will be invalid and its use will generate a run-time error (as usual with C++ functors).
-]
+Furthermore, this library allow to access the type of the bound variables from within the local function, local block, or local exit using the following macro:
-The `boost::local::__function__` template takes two parameters (see the __Reference__ section):
+ #include <boost/local/typeof.hpp>
- template<typename F, size_t defaults = 0> class __function__;
+ ... // Within a local function, local block, or local exit.
+ __BOOST_LOCAL_TYPEOF__(``/bound-variable/``) ...
+ ...
-[variablelist
-[ [F] [
-The template parameter `F` is a function type specifying the function signature using the same syntax as __Boost_Function__'s preferred syntax.
-For example:``
- __function__<int()> // Returns `int` and takes no parameter.
- __function__<int(double, char)> // Returns `int`and takes two parameters: a `double` followed by a `char`.
-``] ]
-[ [defaults] [
-The template parameter `defaults` is a non-negative integer number specifying the number of defaults parameters (counting from the last parameter as usual): `0` if no parameter is optional, `1` if the last parameter is optional, `2` if the last two parameters are optional, etc.
-The `defaults` template parameter must be between `0` and the total number of parameters as specified by `F`, it is optional and it is `0` by default.
-For example:``
- __function__<int(double, char)> // No default: All parameters must be specified.
- __function__<int(double, char), 1> // 1 default: The last `char` parameter is optional.
- __function__<int(double, char), 2> // 2 defaults: All parameters are optional.
-``] ]
+This macro expands to a type expression that evaluates (at compile-time) to the fully qualified type of the specified bound variable.
+
+[note
+This type expression is fully qualified in the sense that it will be constant if the variable is bound by constant and it will also be a reference is the variable is bound by reference (if needed, programmers can strip away the `const` and `&` qualifiers using `boost::remove_const` and `boost::remove_reference`, or similar template metafunctions).
]
+The deduced bound type can be used within the body to declare a local variable, to check concepts, etc.
For example:
[table
[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
-[ [ [doit_va_cpp] ] [ [doit_cpp] ] ]
+[ [ [typeof_va_cpp] ] [ [typeof_cpp] ] ]
]
-In addition, a local function can bind and call another local function.
-For example, the following local function `inc_sum` binds the local function `inc` so `inc_sum` can call `inc`:
+Within templates, `__BOOST_LOCAL_TYPEOF__` does not require to be prefixed by the `typename` keyword but eventual type manipulations need the `typename` prefix as usual:
[table
[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
-[ [ [transform_va_cpp] ] [ [transform_cpp] ] ]
+[ [ [typeof_tpl_va_cpp] ] [ [typeof_tpl_cpp] ] ]
]
[endsect]
+
[section Exception Specifications]
It is possible to program exception specifications for local functions, local blocks, and local exits.
@@ -273,26 +251,6 @@
[endsect]
-[section Storage Classifiers (`auto` and `register`)]
-
-Local function parameters support the storage classifiers as usual in C++.
-The `auto` storage classifier is specified as:
-
- auto ``/parameter-type parameter-name/``
-
-and the `register` storage classifier is specified as:
-
- register ``/parameter-type parameter-name/``
-
-For example:
-
-[table
-[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
-[ [ [add_optimizers_va_cpp] ] [ [add_optimizers_cpp] ] ]
-]
-
-[endsect]
-
[section Inlined Local Functions]
A local function can be declared inlined to increase the chances that the compiler will be able to reduce the local function call run-time by inlining code.
@@ -304,7 +262,7 @@
[important
On ISO C++ compliant compilers (see __BOOST_LOCAL_CONFIG_COMPLIANT__), inlined local functions always have a run-time comparable to their equivalent implementations that use local functor classes (see the __Alternatives__ section).
-However, inlined local functions have the limitation that they cannot be assigned to `boost::local::__function__` and they cannot be passed as template parameters
+However, inlined local functions have the limitation that they cannot be assigned to other functors (like `__boost__function__`) and they cannot be passed as template parameters
[footnote
*Rationale.*
This library uses an indirect function call via a function pointer in order to pass the local function as a template parameter (see the __Implementation__ section).
@@ -360,6 +318,26 @@
[endsect]
+[section Storage Classifiers (`auto` and `register`)]
+
+Local function parameters support the storage classifiers as usual in C++.
+The `auto` storage classifier is specified as:
+
+ auto ``/parameter-type parameter-name/``
+
+and the `register` storage classifier is specified as:
+
+ register ``/parameter-type parameter-name/``
+
+For example:
+
+[table
+[ [__Variadic_Macro_Syntax__] [__Sequencing_Macro_Syntax__] ]
+[ [ [add_optimizers_va_cpp] ] [ [add_optimizers_cpp] ] ]
+]
+
+[endsect]
+
[section Limitations (overloading, operators, etc)]
The following table summarizes all the usual C++ function features that are not supported for local functions.
@@ -378,7 +356,7 @@
[
[ `template<`/template-parameter-list/`>` ]
[ No ]
- [ This is not supported because local functions are implemented using local classes and C++ local classes cannot be templates. ]
+ [ This is not supported because local functions are implemented using local classes and ISO C++ local classes cannot be templates (see __N2657__). ]
]
[
[ `explicit` ]
@@ -387,8 +365,8 @@
]
[
[ `inline` ]
- [ No ]
- [ Local functions are always defined together with their declarations so they are always inlined and there is no need to specify them `inline`. ]
+ [ Yes ]
+ [ Local functions can be specified `inline` to improve the chances that ISO C++ standard compilers can optimize their run-time (but `inline` local functions cannot be passes as template parameters on ISO C++ standard compilers). ]
]
[
[ `extern` ]
@@ -404,10 +382,12 @@
[ `virtual` ]
[ No ]
[ This is not supported because local functions are not member functions.
-
+[footnote
+*Rationale.*
In theory, it would be possible for a local functor class to inherit from another local functor class.
The parenthesized syntax could be extended to specify the eventual base local functor class within the parenthesized signature (e.g., using `... (extends)(`/base/`)`).
However, this "inheritance" feature is not implemented because it seems of [@http://lists.boost.org/Archives/boost/2010/09/170895.php no use] given that local functions can be bound to one another thus they can simply call each other directly without recurring to dynamic binding or base function call.
+]
]
]
[
@@ -418,7 +398,7 @@
[
[ [^/function-name/] ]
[ Yes ]
- [ This is supported but it cannot be overloaded and it cannot be an operator (see the __Tutorial__ and __Advanced_Topics__ sections). ]
+ [ Local functions are named and they can call themselves recursively but they cannot be overloaded and they cannot be operators (see the __Tutorial__ and __Advanced_Topics__ sections). ]
]
[
[ [^/parameter-list/] ]
Modified: sandbox/local/libs/local/doc/qbk/local.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/local.qbk (original)
+++ sandbox/local/libs/local/doc/qbk/local.qbk 2011-05-03 19:54:26 EDT (Tue, 03 May 2011)
@@ -9,7 +9,7 @@
[version 0.2.0 ]
[/ purpose Local functions, blocks, and exits for C++]
[/ category Function Objects and Higher-Order Programming]
- [authors [Caminiti (lorcaminiti_at_[hidden]), Lorenzo]]
+ [authors [Caminiti (lorcaminiti -at- gmail.com), Lorenzo]]
[copyright 2009-2011 Lorenzo Caminiti]
[license
Use, modification, and distribution is subject to the
@@ -30,6 +30,7 @@
[def __Boost_Parameter__ [@http://www.boost.org/doc/libs/release/libs/parameter/doc/index.html Boost.Paramater]]
[def __Boost_Typeof__ [@http://www.boost.org/doc/libs/release/doc/html/typeof.html Boost.Typeof]]
[def __Boost_Function__ [@http://www.boost.org/doc/libs/release/doc/html/function.html Boost.Function]]
+[def __boost__function__ [@http://www.boost.org/doc/libs/release/doc/html/function.html boost::function]]
[def __Boost_TypeTraits__ [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]]
[def __Boost_Chrono__ [@http://www.boost.org/doc/libs/release/libs/chrono/doc/html/index.html Boost.Chrono]]
[def __CPP0x_lambda__ [@http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions C++0x lambda]]
@@ -71,7 +72,6 @@
[def __BOOST_LOCAL_CONFIG_COMPLIANT__ [macroref BOOST_LOCAL_CONFIG_COMPLIANT]]
[def __BOOST_IDENTITY_TYPE__ [macroref BOOST_IDENTITY_TYPE]]
[def __BOOST_IDENTITY_VALUE__ [macroref BOOST_IDENTITY_VALUE]]
-[def __function__ [classref boost::local::function function]]
[def __Variadic_Macro_Syntax__ Variadic Macro Syntax (C99 and later compilers)]
[def __Sequencing_Macro_Syntax__ Sequencing Macro Syntax (all C++ compilers)]
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk