summaryrefslogtreecommitdiff
path: root/libs/scope_exit
diff options
context:
space:
mode:
Diffstat (limited to 'libs/scope_exit')
-rw-r--r--libs/scope_exit/doc/Jamfile.v235
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html98
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html95
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html74
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html57
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html64
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html68
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html74
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID_TPL.html74
-rw-r--r--libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html81
-rw-r--r--libs/scope_exit/doc/html/index.html114
-rw-r--r--libs/scope_exit/doc/html/reference.html59
-rw-r--r--libs/scope_exit/doc/html/scope_exit/acknowledge.html66
-rw-r--r--libs/scope_exit/doc/html/scope_exit/acknowledgements.html75
-rw-r--r--libs/scope_exit/doc/html/scope_exit/alternatives.html335
-rw-r--r--libs/scope_exit/doc/html/scope_exit/compilers.html61
-rw-r--r--libs/scope_exit/doc/html/scope_exit/conf.html49
-rw-r--r--libs/scope_exit/doc/html/scope_exit/getting_started.html138
-rw-r--r--libs/scope_exit/doc/html/scope_exit/no_variadic_macros.html229
-rw-r--r--libs/scope_exit/doc/html/scope_exit/ref.html153
-rw-r--r--libs/scope_exit/doc/html/scope_exit/tutorial.html622
-rw-r--r--libs/scope_exit/doc/scope_exit.qbk786
-rw-r--r--libs/scope_exit/example/Jamfile.v223
-rw-r--r--libs/scope_exit/example/nova.hpp21
-rw-r--r--libs/scope_exit/example/scope_guard.cpp46
-rw-r--r--libs/scope_exit/example/scope_guard_seq.cpp35
-rw-r--r--libs/scope_exit/example/scope_guard_seq_nova.cpp10
-rw-r--r--libs/scope_exit/example/try_catch.cpp68
-rw-r--r--libs/scope_exit/example/try_catch_seq.cpp61
-rw-r--r--libs/scope_exit/example/try_catch_seq_nova.cpp10
-rw-r--r--libs/scope_exit/example/world.cpp114
-rw-r--r--libs/scope_exit/example/world_cxx11_lambda.cpp57
-rw-r--r--libs/scope_exit/index.html25
-rw-r--r--libs/scope_exit/test/Jamfile.v268
-rw-r--r--libs/scope_exit/test/emulation.cpp8
-rw-r--r--libs/scope_exit/test/emulation_const_error.cpp7
-rw-r--r--libs/scope_exit/test/emulation_cv_error.cpp7
-rw-r--r--libs/scope_exit/test/emulation_tpl.cpp8
-rw-r--r--libs/scope_exit/test/emulation_tu_test.cpp7
-rw-r--r--libs/scope_exit/test/native.cpp208
-rw-r--r--libs/scope_exit/test/native_const_error.cpp16
-rw-r--r--libs/scope_exit/test/native_cv_error.cpp20
-rw-r--r--libs/scope_exit/test/native_this.cpp43
-rw-r--r--libs/scope_exit/test/native_this_tpl.cpp45
-rw-r--r--libs/scope_exit/test/native_tpl.cpp82
-rw-r--r--libs/scope_exit/test/native_tu1.cpp15
-rw-r--r--libs/scope_exit/test/native_tu2.cpp15
-rw-r--r--libs/scope_exit/test/native_tu_test.cpp31
-rw-r--r--libs/scope_exit/test/nova.hpp21
-rw-r--r--libs/scope_exit/test/same_line.cpp79
-rw-r--r--libs/scope_exit/test/same_line_seq.cpp71
-rw-r--r--libs/scope_exit/test/same_line_seq_nova.cpp10
-rw-r--r--libs/scope_exit/test/tu_test.hpp43
-rw-r--r--libs/scope_exit/test/world.cpp58
-rw-r--r--libs/scope_exit/test/world_checkpoint.cpp112
-rw-r--r--libs/scope_exit/test/world_checkpoint_all.cpp116
-rw-r--r--libs/scope_exit/test/world_checkpoint_all_seq.cpp110
-rw-r--r--libs/scope_exit/test/world_checkpoint_all_seq_nova.cpp10
-rw-r--r--libs/scope_exit/test/world_checkpoint_seq.cpp99
-rw-r--r--libs/scope_exit/test/world_checkpoint_seq_nova.cpp10
-rw-r--r--libs/scope_exit/test/world_seq.cpp51
-rw-r--r--libs/scope_exit/test/world_seq_nova.cpp10
-rw-r--r--libs/scope_exit/test/world_this.cpp58
-rw-r--r--libs/scope_exit/test/world_this_seq.cpp49
-rw-r--r--libs/scope_exit/test/world_this_seq_nova.cpp10
-rw-r--r--libs/scope_exit/test/world_tpl.cpp59
-rw-r--r--libs/scope_exit/test/world_tpl_seq.cpp50
-rw-r--r--libs/scope_exit/test/world_tpl_seq_nova.cpp10
-rw-r--r--libs/scope_exit/test/world_void.cpp48
-rw-r--r--libs/scope_exit/test/world_void_nova.cpp11
70 files changed, 4146 insertions, 1406 deletions
diff --git a/libs/scope_exit/doc/Jamfile.v2 b/libs/scope_exit/doc/Jamfile.v2
index 973c934e37..847831572c 100644
--- a/libs/scope_exit/doc/Jamfile.v2
+++ b/libs/scope_exit/doc/Jamfile.v2
@@ -1,15 +1,30 @@
-# Copyright 2006 Alexander Nasonov.
-# Distributed under the Boost Software License, Version 1.0. (See accompanying
-# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+# Copyright (C) 2006-2009, 2012 Alexander Nasonov
+# Copyright (C) 2012 Lorenzo Caminiti
+# Distributed under the Boost Software License, Version 1.0
+# (see accompanying file LICENSE_1_0.txt or a copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# Home at http://www.boost.org/libs/scope_exit
-using quickbook ;
+import quickbook ;
+using boostbook ;
-xml scope_exit : scope_exit.qbk ;
-boostbook standalone : scope_exit
- :
- # Path for links to Boost:
- <xsl:param>boost.root=../../../..
+doxygen reference
+ : ../../../boost/scope_exit.hpp
+ : <reftitle>"Reference"
+ <doxygen:param>PREDEFINED="DOXYGEN"
+ <doxygen:param>QUIET=YES
+ <doxygen:param>WARN_IF_UNDOCUMENTED=NO
+ <doxygen:param>HIDE_UNDOC_MEMBERS=YES
+ <doxygen:param>HIDE_UNDOC_CLASSES=YES
+ <doxygen:param>ALIASES=" Params=\"<b>Parameters:</b> <table border="0">\" Param{2}=\"<tr><td><b><tt>\\1</tt></b></td><td>\\2</td></tr>\" EndParams=\"</table>\" Returns=\"<b>Returns:</b>\" Note=\"<b>Note:</b>\" Warning=\"<b>Warning:</b>\" See=\"<b>See:</b>\" RefSect{2}=\"\\xmlonly<link linkend='scope_exit.\\1'>\\2</link>\\endxmlonly\" RefClass{1}=\"\\xmlonly<computeroutput><classname alt='\\1'>\\1</classname></computeroutput>\\endxmlonly\" RefFunc{1}=\"\\xmlonly<computeroutput><functionname alt='\\1'>\\1</functionname></computeroutput>\\endxmlonly\" RefMacro{1}=\"\\xmlonly<computeroutput><macroname alt='\\1'>\\1</macroname></computeroutput>\\endxmlonly\" "
+ ;
+
+xml qbk : scope_exit.qbk : <dependency>reference ;
+
+boostbook doc : qbk
+ : <xsl:param>boost.root=../../../..
+ <xsl:param>boost.defaults=Boost
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/scope_exit/doc/html
- ;
+ ;
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html
new file mode 100644
index 0000000000..2337313957
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html
@@ -0,0 +1,98 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="reference.html" title="Reference">
+<link rel="next" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT</span></h2>
+<p>BOOST_SCOPE_EXIT &#8212; This macro declares a scope exit. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT(capture_list)</pre></div>
+<div class="refsect1">
+<a name="id835365"></a><h2>Description</h2>
+<p>The scope exit declaration schedules the execution of the scope exit body at the exit of the enclosing scope:</p>
+<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
+ <span class="special">...</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">capture_list</span><span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Body code.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p>The enclosing scope must be local. If multiple scope exits are declared within the same enclosing scope, the scope exit bodies are executed in the reversed order of their declarations. Note how the end of the scope exit body must be marked by <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">capture_list</code></strong></span></td>
+<td>On compilers that support variadic macros (see also Boost.Config <code class="computeroutput">BOOST_NO_VARIADIC_MACROS</code>), the capture list syntax is defined by the following grammar: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">capture_list</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="special">|</span> <span class="identifier">capture_tuple</span> <span class="special">|</span> <span class="identifier">capture_sequence</span>
+ <span class="identifier">capture_tuple</span><span class="special">:</span>
+ <span class="identifier">capture</span><span class="special">,</span> <span class="identifier">capture</span><span class="special">,</span> <span class="special">...</span>
+ <span class="identifier">capture_sequence</span><span class="special">:</span>
+ <span class="special">(</span><span class="identifier">capture</span><span class="special">)</span> <span class="special">(</span><span class="identifier">capture</span><span class="special">)</span> <span class="special">...</span>
+ <span class="identifier">capture</span><span class="special">:</span>
+ <span class="special">[</span><span class="special">&amp;</span><span class="special">]</span><span class="identifier">variable</span> <span class="special">|</span> <span class="identifier">this_</span>
+</pre> On compilers that do not support variadic macros, <code class="computeroutput">capture_tuple</code> cannot be used: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">capture_list</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="special">|</span> <span class="identifier">capture_sequence</span>
+</pre> Furthermore, if <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS">BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</a></code> is defined on C++11 compilers that support lambda functions (i.e., Boost.Config's <code class="computeroutput">BOOST_NO_LAMBDAS</code> is not defined) then a semicolon <code class="computeroutput">;</code> can be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> and <code class="computeroutput">this</code> can be used instead of <code class="computeroutput">this_</code>: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">capture</span><span class="special">:</span>
+ <span class="special">[</span><span class="special">&amp;</span><span class="special">]</span><span class="identifier">variable</span> <span class="special">|</span> <span class="identifier">this_</span> <span class="special">|</span> <span class="keyword">this</span>
+</pre>(Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the tokens resulting from the expression.) </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>Note that on compilers that support variadic macros (most of moder compliers and all C++11 compilers), the capture list can be specified as a comma-separated list of tokens (this is the preferred syntax). However, on all compilers the same macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> also allows to specify the capture list as a Boost.Preprocessor sequence of tokens (for supporting compilers without variadic macros and for backward compatibility with older versions of this library).</p>
+<p>The name <code class="computeroutput">variable</code> of each captured variable must be a valid name in the enclosing scope and it must appear exactly once in the capture list. If a capture starts with the ampersand sign <code class="computeroutput">&amp;</code>, the corresponding variable will be available by reference within the scope exit body; otherwise, a copy of the variable will be made at the point of the scope exit declaration and that copy will be available inside the scope exit body (in this case, the variable's type must be <code class="computeroutput">CopyConstructible</code>).</p>
+<p>From within a member function, the object <code class="computeroutput">this</code> can be captured using the special name <code class="computeroutput">this_</code> in both the capture list and the scope exit body (using <code class="computeroutput">this</code> instead of <code class="computeroutput">this_</code> in the scope exit body leads to undefined behaviour).</p>
+<p>It is possible to capture no variable by specifying the capture list as <code class="computeroutput">void</code> (regardless of variadic macro support).</p>
+<p>Only variables listed in the capture list, static variables, <code class="computeroutput">extern</code> variables, global variables, functions, and enumerations from the enclosing scope can be used inside the scope exit body.</p>
+<p>On various GCC versions the special macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> within templates (to maximize portability, it is recommended to always use <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> within templates).</p>
+<p>On C++11, it is possible capture all variables in scope without listing their names one-by-one using the macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>.</p>
+<p>In general, the special macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> when it is necessary to expand multiple scope exit declarations on the same line.</p>
+<p><span class="bold"><strong>Warning:</strong></span> The implementation executes the scope exit body within a destructor thus the scope exit body must never throw in order to comply with STL exception safety requirements.</p>
+<p><span class="bold"><strong>Note:</strong></span> The implementation uses Boost.Typeof to automatically deduce the types of the captured variables. In order to compile code in type-of emulation mode, all types must be properly registered with Boost.Typeof (see the <a class="link" href="scope_exit/getting_started.html" title="Getting Started"> Getting Started</a> section).</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/tutorial.html" title="Tutorial"> Tutorial</a> section, <a class="link" href="scope_exit/getting_started.html" title="Getting Started"> Getting Started</a> section, <a class="link" href="scope_exit/no_variadic_macros.html" title="Annex: No Variadic Macros"> No Variadic Macros</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html
new file mode 100644
index 0000000000..7bd6201a0c
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html
@@ -0,0 +1,95 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_ALL</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">
+<link rel="next" href="BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ID_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ALL_ID.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_ALL"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_ALL</span></h2>
+<p>BOOST_SCOPE_EXIT_ALL &#8212; This macro declares a scope exit that captures all variables in scope (C++11 only). </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_ALL(capture_list)</pre></div>
+<div class="refsect1">
+<a name="id836855"></a><h2>Description</h2>
+<p>This macro accepts a capture list starting with either <code class="computeroutput">&amp;</code> or <code class="computeroutput">=</code> to capture all variables in scope by reference or value respectively (following the same syntax of C++11 lambdas). A part from that, this macro works like <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more information):</p>
+<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
+ <span class="special">...</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_ALL</span><span class="special">(</span><span class="identifier">capture_list</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// C++11 only.</span>
+ <span class="special">...</span> <span class="comment">// Body code.</span>
+ <span class="special">}</span><span class="special">;</span> <span class="comment">// Use `;` instead of `BOOST_SCOPE_EXIT_END` (C++11 only).</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p>Note how the end of the scope exit body declared by this macro must be marked by a semi-column <code class="computeroutput">;</code> (and not by <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>).</p>
+<p><span class="bold"><strong>Warning:</strong></span> This macro is only available on C++11 compilers (specifically, on C++11 compilers that do not define the Boost.Config <code class="computeroutput">BOOST_NO_LAMBDAS</code> macro). It is not defined on non-C++11 compilers so its use on non-C++11 compilers will generate a compiler error.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">capture_list</code></strong></span></td>
+<td>On compilers that support variadic macros (see also Boost.Config <code class="computeroutput">BOOST_NO_VARIADIC_MACROS</code>), the capture list syntax is defined by the following grammar: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">capture_list</span><span class="special">:</span>
+ <span class="identifier">capture_tuple</span> <span class="special">|</span> <span class="identifier">capture_sequence</span>
+<span class="identifier">capture_tuple</span><span class="special">:</span>
+ <span class="special">{</span><span class="special">&amp;</span> <span class="special">|</span> <span class="special">=</span><span class="special">}</span> <span class="special">[</span><span class="special">,</span> <span class="identifier">capture</span><span class="special">,</span> <span class="identifier">capture</span><span class="special">,</span> <span class="special">...</span><span class="special">]</span>
+<span class="identifier">capture_sequence</span><span class="special">:</span>
+ <span class="special">{</span><span class="special">(</span><span class="special">&amp;</span><span class="special">)</span> <span class="special">|</span> <span class="special">(</span><span class="special">=</span><span class="special">)</span><span class="special">}</span> <span class="special">[</span><span class="special">(</span><span class="identifier">capture</span><span class="special">)</span> <span class="special">(</span><span class="identifier">capture</span><span class="special">)</span> <span class="special">...</span><span class="special">]</span>
+<span class="identifier">capture</span><span class="special">:</span>
+ <span class="special">[</span><span class="special">&amp;</span><span class="special">]</span><span class="identifier">variable</span> <span class="special">|</span> <span class="identifier">this_</span>
+</pre> On compilers that do not support variadic macros, <code class="computeroutput">capture_tuple</code> cannot be used: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">capture_list</span><span class="special">:</span>
+ <span class="keyword">void</span> <span class="special">|</span> <span class="identifier">capture_sequence</span>
+</pre> Furthermore, on C++11 compilers that support the use of <code class="computeroutput">typename</code> outside templates, also <code class="computeroutput">this</code> can be used to capture the object at member function scope: <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"> <span class="identifier">capture</span><span class="special">:</span>
+ <span class="special">[</span><span class="special">&amp;</span><span class="special">]</span><span class="identifier">variable</span> <span class="special">|</span> <span class="identifier">this_</span> <span class="special">|</span> <span class="keyword">this</span>
+</pre>(Lexical conventions: <code class="computeroutput">token1 | token2</code> means either <code class="computeroutput">token1</code> or <code class="computeroutput">token2</code>; <code class="computeroutput">[token]</code> means either <code class="computeroutput">token</code> or nothing; <code class="computeroutput">{expression}</code> means the token resulting from the expression.) </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p>Note that on compilers with variadic macro support (which should be all C++11 compilers), the capture list can be specified as a comma-separated list. On all compilers, the same macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> also allows to specify the capture list as a Boost.Preprocessor sequence.</p>
+<p>The capture list must always contain at least the leading <code class="computeroutput">&amp;</code> or <code class="computeroutput">=</code> so it can never be <code class="computeroutput">void</code> (<code class="computeroutput">BOOST_SCOPE_EXIT(void)</code> should be used to program scope exits with an empty capture list).</p>
+<p>In general, the special macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> when it is necessary to expand multiple scope exit declarations on the same line.</p>
+<p><span class="bold"><strong>Warning:</strong></span> This macro capture list follows the exact same syntax of C++11 lambda captures which is unfortunately different from the syntax of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> captures (unless programmers define the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS">BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</a></code> macro). For example, like C++11 lambda functions, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> requires to capture data members by capturing the object <code class="computeroutput">this</code> while <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> allows to capture data members directly and without capturing the object.</p>
+<p><span class="bold"><strong>Warning:</strong></span> The implementation executes the scope exit body within a destructor thus the scope exit body must never throw in order to comply with STL exception safety requirements.</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro can always be used also within templates (so there is no need for a <code class="computeroutput">BOOST_SCOPE_EXIT_ALL_TPL</code> macro).</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/tutorial.html" title="Tutorial"> Tutorial</a> section, <a class="link" href="scope_exit/no_variadic_macros.html" title="Annex: No Variadic Macros"> No Variadic Macros</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ID_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ALL_ID.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html
new file mode 100644
index 0000000000..b535098a36
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html
@@ -0,0 +1,74 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_ALL_ID</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">
+<link rel="next" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ALL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_ALL_ID"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_ALL_ID</span></h2>
+<p>BOOST_SCOPE_EXIT_ALL_ID &#8212; This macro allows to expand on the same line multiple scope exits that capture all variables in scope (C++11 only). </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_ALL_ID(id, capture_list)</pre></div>
+<div class="refsect1">
+<a name="id837507"></a><h2>Description</h2>
+<p>This macro is equivalent to <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> but it can be expanded multiple times on the same line if different identifiers <code class="computeroutput">id</code> are provided for each expansion (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> for more information). As with <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>, this macro is only available on C++11 compilers (specifically, on C++11 compilers that do not define the Boost.Config <code class="computeroutput">BOOST_NO_LAMBDAS</code> macro).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">id</code></strong></span></td>
+<td>A unique identifier token which can be concatenated by the preprocessor (<code class="computeroutput">__LINE__</code>, <code class="computeroutput">scope_exit_number_1_on_line_123</code>, a combination of alphanumeric tokens, etc). </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">capture_list</code></strong></span></td>
+<td>Same as the <code class="computeroutput">capture_list</code> parameter of the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> macro. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro can be useful when the scope exit macros are expanded within user-defined macros (because nested macros expand on the same line). On some compilers (e.g., MSVC which supports the non standard <code class="computeroutput">__COUNTER__</code> macro) it might not be necessary to use this macro but the use of this macro is always necessary to ensure portability when expanding multiple scope exit declarations on the same line.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/tutorial.html" title="Tutorial"> Tutorial</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ALL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html
new file mode 100644
index 0000000000..1df0c68274
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html
@@ -0,0 +1,57 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">
+<link rel="next" href="scope_exit/acknowledgements.html" title="Acknowledgements">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_END_ID.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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="scope_exit/acknowledgements.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</span></h2>
+<p>BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS &#8212; Force to use C++11 lambda functions to implement scope exits. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</pre></div>
+<div class="refsect1">
+<a name="id839635"></a><h2>Description</h2>
+<p>If programmers define this configuration macro on a C++11 compiler for which the Boost.Config macro <code class="computeroutput">BOOST_NO_LAMBDAS</code> is not defined, the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> macros will use C++11 lambda functions to declare scope exits. By default this macro is not defined.</p>
+<p><span class="bold"><strong>Warning:</strong></span> When scope exits are implemented using lambda functions, the syntax of the capture list follows the exact same syntax of C++11 lambda captures which is in general different from the legacy capture syntax of this library. For example, C++11 lambdas require to capture data members by capturing the object <code class="computeroutput">this</code> while this library always allowed to capture data members directly. Therefore, when this configuration macro is defined, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> and <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> are no longer backward compatible (and this is why this macro is not defined by default).</p>
+<p>A semicolon <code class="computeroutput">;</code> can be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> when this configuration macro is defined (but it is recommended to always use <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> so to maximize portability).</p>
+<p><span class="bold"><strong>Note:</strong></span> This configuration macro does not control the definition of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> which is always and automatically defined on compilers that support C++11 lambda functions.</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_END_ID.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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="scope_exit/acknowledgements.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html
new file mode 100644
index 0000000000..cc41620a75
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_END</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">
+<link rel="next" href="BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ALL_ID.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_END_ID.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_END"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_END</span></h2>
+<p>BOOST_SCOPE_EXIT_END &#8212; This macro marks the end of a scope exit body. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_END</pre></div>
+<div class="refsect1">
+<a name="id837668"></a><h2>Description</h2>
+<p>This macro must follow the closing curly bracket <code class="computeroutput">}</code> that ends the body of either <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> or <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>:</p>
+<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
+ <span class="special">...</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">capture_list</span><span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Body code.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p>In general, the special macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">BOOST_SCOPE_EXIT_END_ID</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> when it is necessary to expand multiple scope exit bodies on the same line.</p>
+<p><span class="bold"><strong>Note:</strong></span> If programmers define the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS">BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</a></code> macro on C++11 compilers, a semicolon <code class="computeroutput">;</code> can be used instead of this macro. However, to maximize portability, it is recommended to always use <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/tutorial.html" title="Tutorial"> Tutorial</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">BOOST_SCOPE_EXIT_END_ID</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ALL_ID.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_END_ID.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html
new file mode 100644
index 0000000000..b3e0751775
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_END_ID</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">
+<link rel="next" href="BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_END_ID"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_END_ID</span></h2>
+<p>BOOST_SCOPE_EXIT_END_ID &#8212; This macro allows to terminate multiple scope exit bodies on the same line. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_END_ID(id)</pre></div>
+<div class="refsect1">
+<a name="id839503"></a><h2>Description</h2>
+<p>This macro is equivalent to <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> but it can be expanded multiple times on the same line if different identifiers <code class="computeroutput">id</code> are provided for each expansion (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> for more information).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody><tr>
+<td><span class="bold"><strong><code class="computeroutput">id</code></strong></span></td>
+<td>A unique identifier token which can be concatenated by the preprocessor (<code class="computeroutput">__LINE__</code>, <code class="computeroutput">scope_exit_number_1_on_line_123</code>, a combination of alphanumeric tokens, etc). </td>
+</tr></tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro can be useful when the scope exit macros are expanded within user-defined macros (because macros all expand on the same line). On some compilers (e.g., MSVC which supports the non standard <code class="computeroutput">__COUNTER__</code> macro) it might not be necessary to use this macro but the use of this macro is always necessary to ensure portability when expanding multiple scope exit macros on the same line (because this library can only portably use <code class="computeroutput">__LINE__</code> to internally generate unique identifiers).</p>
+<p><span class="bold"><strong>See:</strong></span> <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_END.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html
new file mode 100644
index 0000000000..099e8d6106
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html
@@ -0,0 +1,74 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_ID</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">
+<link rel="next" href="BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ID_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_ID"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_ID</span></h2>
+<p>BOOST_SCOPE_EXIT_ID &#8212; This macro allows to expand multiple scope exit declarations on the same line. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_ID(id, capture_list)</pre></div>
+<div class="refsect1">
+<a name="id836521"></a><h2>Description</h2>
+<p>This macro is equivalent to <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> but it can be expanded multiple times on the same line if different identifiers <code class="computeroutput">id</code> are provided for each expansion (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more information).</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">id</code></strong></span></td>
+<td>A unique identifier token which can be concatenated by the preprocessor (<code class="computeroutput">__LINE__</code>, <code class="computeroutput">scope_exit_number_1_on_line_123</code>, a combination of alphanumeric tokens, etc). </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">capture_list</code></strong></span></td>
+<td>Same as the <code class="computeroutput">capture_list</code> parameter of the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> macro. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro can be useful when the scope exit macros are expanded within user-defined macros (because nested macros expand on the same line). On some compilers (e.g., MSVC which supports the non standard <code class="computeroutput">__COUNTER__</code> macro) it might not be necessary to use this macro but the use of this macro is always necessary to ensure portability when expanding multiple scope exit declarations on the same line.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/tutorial.html" title="Tutorial"> Tutorial</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">BOOST_SCOPE_EXIT_END_ID</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_TPL.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ID_TPL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID_TPL.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID_TPL.html
new file mode 100644
index 0000000000..a505c8e65f
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID_TPL.html
@@ -0,0 +1,74 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_ID_TPL</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">
+<link rel="next" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ID.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ALL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_ID_TPL"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_ID_TPL</span></h2>
+<p>BOOST_SCOPE_EXIT_ID_TPL &#8212; This macro is required to expand multiple scope exit declarations on the same line within templates on various versions of GCC. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_ID_TPL(id, capture_list)</pre></div>
+<div class="refsect1">
+<a name="id836684"></a><h2>Description</h2>
+<p>This macro is equivalent to <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> but it can be expanded multiple times on the same line if different identifiers <code class="computeroutput">id</code> are provided for each expansion (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> for more information). As with <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>, it is recommended to always use this macro when expanding scope exits multiple times on the same line within templates.</p>
+<p><span class="bold"><strong>Parameters:</strong></span> </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">id</code></strong></span></td>
+<td>A unique identifier token which can be concatenated by the preprocessor (<code class="computeroutput">__LINE__</code>, <code class="computeroutput">scope_exit_number_1_on_line_123</code>, a combination of alphanumeric tokens, etc). </td>
+</tr>
+<tr>
+<td><span class="bold"><strong><code class="computeroutput">capture_list</code></strong></span></td>
+<td>Same as the <code class="computeroutput">capture_list</code> parameter of the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> macro. </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+</p>
+<p><span class="bold"><strong>Note:</strong></span> This macro can be useful when the scope exit macros are expanded within user-defined macros (because nested macros expand on the same line). On some compilers (e.g., MSVC which supports the non standard <code class="computeroutput">__COUNTER__</code> macro) it might not be necessary to use this macro but the use of this macro is always necessary to ensure portability when expanding multiple scope exit declarations on the same line.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/tutorial.html" title="Tutorial"> Tutorial</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">BOOST_SCOPE_EXIT_END_ID</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT_ID.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ALL.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html
new file mode 100644
index 0000000000..a310f24bfa
--- /dev/null
+++ b/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html
@@ -0,0 +1,81 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Macro BOOST_SCOPE_EXIT_TPL</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">
+<link rel="prev" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">
+<link rel="next" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ID.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="refentry">
+<a name="BOOST_SCOPE_EXIT_TPL"></a><div class="titlepage"></div>
+<div class="refnamediv">
+<h2><span class="refentrytitle">Macro BOOST_SCOPE_EXIT_TPL</span></h2>
+<p>BOOST_SCOPE_EXIT_TPL &#8212; This macro is a workaround for various versions of GCC to declare scope exits within templates. </p>
+</div>
+<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
+<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="reference.html#header.boost.scope_exit_hpp" title="Header &lt;boost/scope_exit.hpp&gt;">boost/scope_exit.hpp</a>&gt;
+
+</span>BOOST_SCOPE_EXIT_TPL(capture_list)</pre></div>
+<div class="refsect1">
+<a name="id835969"></a><h2>Description</h2>
+<p>Various versions of the GCC compiler do not compile <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> inside function templates. As a workaround, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> should be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> in these cases:</p>
+<pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
+ <span class="special">...</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_TPL</span><span class="special">(</span><span class="identifier">capture_list</span><span class="special">)</span> <span class="special">{</span>
+ <span class="special">...</span> <span class="comment">// Body code.</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+ <span class="special">...</span>
+ <span class="special">}</span>
+</pre>
+<p>The syntax of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is the exact same as the one of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more information).</p>
+<p>On C++11 compilers, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is not needed because <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> always compiles on GCC versions that support C++11. However, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> is still provided on C++11 so to write code that is portable between C++03 and C++11 compilers. It is recommended to always use <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> within templates so to maximize portability.</p>
+<p>In general, the special macro <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a></code> must be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> when it is necessary to expand multiple scope exit declarations on the same line within templates.</p>
+<p><span class="bold"><strong>Note:</strong></span> The issue in compiling scope exit declarations that some GCC versions have is illustrated by the following code (see also <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37920" target="_top">GCC bug 37920</a>): </p>
+<pre class="programlisting"> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
+ <span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">x</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">0</span><span class="special">;</span>
+ <span class="keyword">struct</span> <span class="identifier">local</span> <span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="identifier">__typeof__</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span> <span class="identifier">typeof_i</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">__typeof__</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span> <span class="identifier">typeof_x</span><span class="special">;</span>
+ <span class="special">}</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">local</span><span class="special">::</span><span class="identifier">typeof_i</span> <span class="identifier">i_type</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">local</span><span class="special">::</span><span class="identifier">typeof_x</span> <span class="identifier">x_type</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="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">f</span><span class="special">(</span><span class="number">0</span><span class="special">)</span><span class="special">;</span> <span class="special">}</span>
+</pre>
+<p> This can be fixed by adding <code class="computeroutput">typename</code> in front of <code class="computeroutput">local::typeof_i</code> and <code class="computeroutput">local::typeof_x</code> (which is the approach followed by the implementation of the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> macro).</p>
+<p><span class="bold"><strong>Note:</strong></span> Although <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> has the same suffix as <code class="computeroutput">BOOST_TYPEOF_TPL</code>, it does not follow the Boost.Typeof convention.</p>
+<p><span class="bold"><strong>See:</strong></span> <a class="link" href="scope_exit/tutorial.html" title="Tutorial"> Tutorial</a> section, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a></code>. </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="reference.html#header.boost.scope_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_SCOPE_EXIT_ID.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/index.html b/libs/scope_exit/doc/html/index.html
index 9679879b5b..5059f6b2cc 100644
--- a/libs/scope_exit/doc/html/index.html
+++ b/libs/scope_exit/doc/html/index.html
@@ -1,11 +1,11 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Chapter&#160;1.&#160;Boost.ScopeExit</title>
+<title>Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="next" href="scope_exit/tutorial.html" title="Tutorial">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="next" href="scope_exit/getting_started.html" title="Getting Started">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -17,61 +17,113 @@
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="scope_exit/tutorial.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="scope_exit/getting_started.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
<div class="chapter">
<div class="titlepage"><div>
<div><h2 class="title">
-<a name="scope_exit"></a>Chapter&#160;1.&#160;Boost.ScopeExit</h2></div>
+<a name="scope_exit"></a>Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0</h2></div>
<div><div class="author"><h3 class="author">
<span class="firstname">Alexander</span> <span class="surname">Nasonov</span>
</h3></div></div>
-<div><p class="copyright">Copyright &#169; 2006 -2009 Alexander Nasonov</p></div>
+<div><div class="author"><h3 class="author">
+<span class="firstname">Lorenzo</span> <span class="surname">Caminiti <code class="email">&lt;<a class="email" href="mailto:lorcaminiti@gmail.com">lorcaminiti@gmail.com</a>&gt;</code></span>
+</h3></div></div>
+<div><p class="copyright">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti</p></div>
<div><div class="legalnotice">
-<a name="id759689"></a><p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
- http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
+<a name="scope_exit.legal"></a><p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></div>
</div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
-<dt><span class="section"><a href="index.html#scope_exit.intro"> Introduction</a></span></dt>
-<dt><span class="section"><a href="scope_exit/tutorial.html"> Tutorial</a></span></dt>
-<dt><span class="section"><a href="scope_exit/alternatives.html"> Alternatives</a></span></dt>
-<dt><span class="section"><a href="scope_exit/compilers.html"> Supported Compilers</a></span></dt>
-<dt><span class="section"><a href="scope_exit/conf.html"> Configuration</a></span></dt>
-<dt><span class="section"><a href="scope_exit/ref.html"> Reference</a></span></dt>
-<dt><span class="section"><a href="scope_exit/acknowledge.html"> Acknowledge</a></span></dt>
+<dt><span class="section"><a href="index.html#scope_exit.introduction">Introduction</a></span></dt>
+<dt><span class="section"><a href="scope_exit/getting_started.html">Getting Started</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="scope_exit/getting_started.html#scope_exit.getting_started.this_documentation">This Documentation</a></span></dt>
+<dt><span class="section"><a href="scope_exit/getting_started.html#scope_exit.getting_started.compilers_and_platforms">Compilers
+ and Platforms</a></span></dt>
+<dt><span class="section"><a href="scope_exit/getting_started.html#scope_exit.getting_started.installation">Installation</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="scope_exit/tutorial.html">Tutorial</a></span></dt>
+<dd><dl>
+<dt><span class="section"><a href="scope_exit/tutorial.html#scope_exit.tutorial.capturing_variables">Capturing Variables</a></span></dt>
+<dt><span class="section"><a href="scope_exit/tutorial.html#scope_exit.tutorial.capturing_the_object__this_">Capturing
+ The Object <code class="computeroutput"><span class="keyword">this</span></code></a></span></dt>
+<dt><span class="section"><a href="scope_exit/tutorial.html#scope_exit.tutorial.capturing_no_variable">Capturing
+ No Variable</a></span></dt>
+<dt><span class="section"><a href="scope_exit/tutorial.html#scope_exit.tutorial.capturing_all_variables__c__11_only_">Capturing
+ All Variables (C++11 Only)</a></span></dt>
+<dt><span class="section"><a href="scope_exit/tutorial.html#scope_exit.tutorial.template_workaround__gcc_">Template
+ Workaround (GCC)</a></span></dt>
+<dt><span class="section"><a href="scope_exit/tutorial.html#scope_exit.tutorial.same_line_expansions">Same Line Expansions</a></span></dt>
+</dl></dd>
+<dt><span class="section"><a href="scope_exit/alternatives.html">Annex: Alternatives</a></span></dt>
+<dt><span class="section"><a href="scope_exit/no_variadic_macros.html">Annex: No Variadic Macros</a></span></dt>
+<dt><span class="section"><a href="reference.html">Reference</a></span></dt>
+<dd><dl><dt><span class="section"><a href="reference.html#header.boost.scope_exit_hpp">Header &lt;boost/scope_exit.hpp&gt;</a></span></dt></dl></dd>
+<dt><span class="section"><a href="scope_exit/acknowledgements.html">Acknowledgements</a></span></dt>
</dl>
</div>
-<div class="section">
+<p>
+ This library allows to execute arbitrary code when the enclosing scope exits.
+ </p>
+<div class="section scope_exit_introduction">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="scope_exit.intro"></a> Introduction</h2></div></div></div>
+<a name="scope_exit.introduction"></a><a class="link" href="index.html#scope_exit.introduction" title="Introduction">Introduction</a>
+</h2></div></div></div>
<p>
- Nowadays, every C++ developer is familiar with <a href="http://www.research.att.com/~bs/glossary.html#Gresource-acquisition-is-initialization" target="_top">RAII</a>
+ Nowadays, every C++ developer is familiar with the Resource Acquisition Is
+ Initialization (<a href="http://www.research.att.com/~bs/glossary.html#Gresource-acquisition-is-initialization" target="_top">RAII</a>)
technique. It binds resource acquisition and release to initialization and
- destruction of a variable that holds the resource. But there are times when
- writing a special class for such variable is not worth the effort.
+ destruction of a variable that holds the resource. There are times when writing
+ a special class for such a variable is not worth the effort. This is when
+ <a class="link" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> comes into play.
</p>
<p>
- This is when <a class="link" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> macro comes into play.
- You put resource acquisition directly in your code and next to it you write
- a code that releases the resource.
+ Programmers can put resource acquisition directly in their code and next to
+ it, they can write code that releases the resource using this library. For
+ example (see also <a href="../../test/world.cpp" target="_top"><code class="literal">world.cpp</code></a>):
+ <sup>[<a name="scope_exit.introduction.f0" href="#ftn.scope_exit.introduction.f0" class="footnote">1</a>]</sup>
</p>
<p>
- Read <a class="link" href="scope_exit/tutorial.html" title="Tutorial">Tutorial</a> to find out how to
- write programs with <a class="link" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> or jump straight
- to the <a class="link" href="scope_exit/ref.html" title="Reference">Reference</a> section.
+</p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span> <span class="comment">// (1) direct action</span>
+ <span class="comment">// Following block is executed when the enclosing scope exits.</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">persons_</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span> <span class="comment">// (2) rollback action</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+
+ <span class="comment">// ... // (3) other operations</span>
+
+ <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span> <span class="comment">// (4) disable rollback actions</span>
+<span class="special">}</span>
+</pre>
+<p>
</p>
</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.introduction.f0" href="#scope_exit.introduction.f0" class="para">1</a>] </sup>
+ Older versions of this library used a <a href="http://www.boost.org/libs/preprocessor" target="_top">Boost.Preprocessor</a>
+ sequence to specify the list of captured variables. While maintaining full
+ backward compatibility, it is now possible to specify the captured variables
+ also using a comma-separated list (which is the preferred syntax). See the
+ <a class="link" href="scope_exit/no_variadic_macros.html" title="Annex: No Variadic Macros">No Variadic Macros</a> section
+ for more information.
+ </p></div>
+</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: July 08, 2010 at 22:36:27 GMT</small></p></td>
+<td align="left"><p><small>Last revised: April 28, 2012 at 01:48:44 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
-<div class="spirit-nav"><a accesskey="n" href="scope_exit/tutorial.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="spirit-nav"><a accesskey="n" href="scope_exit/getting_started.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
</body>
</html>
diff --git a/libs/scope_exit/doc/html/reference.html b/libs/scope_exit/doc/html/reference.html
new file mode 100644
index 0000000000..7a7e31c826
--- /dev/null
+++ b/libs/scope_exit/doc/html/reference.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Reference</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="prev" href="scope_exit/no_variadic_macros.html" title="Annex: No Variadic Macros">
+<link rel="next" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center"><a href="../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="scope_exit/no_variadic_macros.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section reference">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="reference"></a>Reference</h2></div></div></div>
+<div class="toc"><dl><dt><span class="section"><a href="reference.html#header.boost.scope_exit_hpp">Header &lt;boost/scope_exit.hpp&gt;</a></span></dt></dl></div>
+<div class="section header_boost_scope_exit_hpp">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="header.boost.scope_exit_hpp"></a>Header &lt;<a href="../../../../boost/scope_exit.hpp" target="_top">boost/scope_exit.hpp</a>&gt;</h3></div></div></div>
+<p>Scope exits allow to execute arbitrary code when the enclosing scope exits. </p>
+<pre class="synopsis">
+
+<a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a>(capture_list)
+<a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a>(capture_list)
+<a class="link" href="BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a>(id, capture_list)
+<a class="link" href="BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a>(id, capture_list)
+<a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a>(capture_list)
+<a class="link" href="BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a>(id, capture_list)
+<a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a>
+<a class="link" href="BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">BOOST_SCOPE_EXIT_END_ID</a>(id)
+<a class="link" href="BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS">BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</a></pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="scope_exit/no_variadic_macros.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="BOOST_SCOPE_EXIT.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/acknowledge.html b/libs/scope_exit/doc/html/scope_exit/acknowledge.html
deleted file mode 100644
index f880308b28..0000000000
--- a/libs/scope_exit/doc/html/scope_exit/acknowledge.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Acknowledge</title>
-<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="prev" href="ref.html" title="Reference">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
-<td align="center"><a href="../../../../../index.html">Home</a></td>
-<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
-<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
-<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
-<td align="center"><a href="../../../../../more/index.htm">More</a></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="ref.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="scope_exit.acknowledge"></a> Acknowledge</h2></div></div></div>
-<p>
- (in chronological order)
- </p>
-<p>
- Maxim Yegorushkin for sending me a code where he used a local struct to clean
- up resources.
- </p>
-<p>
- Andrei Alexandrescu for pointing me to <a href="http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement" target="_top">scope(exit)</a>
- construct of the <a href="http://www.digitalmars.com/d/index.html" target="_top">D</a>
- programming language.
- </p>
-<p>
- Pavel Vozenilek and Maxim Yanchenko for reviews of early drafts of the library.
- </p>
-<p>
- Steven Watanabe for his valuable ideas.
- </p>
-<p>
- Jody Hagins for good comments that helped to significantly improve the documentation.
- </p>
-<p>
- Richard Webb for testing the library on MSVC compiler.
- </p>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2006 -2009 Alexander Nasonov<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
- http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="ref.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
-</div>
-</body>
-</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/acknowledgements.html b/libs/scope_exit/doc/html/scope_exit/acknowledgements.html
new file mode 100644
index 0000000000..830865af82
--- /dev/null
+++ b/libs/scope_exit/doc/html/scope_exit/acknowledgements.html
@@ -0,0 +1,75 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Acknowledgements</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="prev" href="../BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
+</div>
+<div class="section scope_exit_acknowledgements">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="scope_exit.acknowledgements"></a><a class="link" href="acknowledgements.html" title="Acknowledgements">Acknowledgements</a>
+</h2></div></div></div>
+<p>
+ Alexander Nasonov is the original library author.
+ </p>
+<p>
+ Lorenzo Caminiti added variadic macro support, capture of the object <code class="computeroutput"><span class="identifier">this_</span></code>, empty captures using <code class="computeroutput"><span class="keyword">void</span></code>, and <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT_ALL</span></code>.
+ </p>
+<p>
+ Thanks to the following people (in chronological order):
+ </p>
+<p>
+ Maxim Yegorushkin for sharing code where he used a local struct to clean up
+ resources;
+ </p>
+<p>
+ Andrei Alexandrescu for pointing out the <a href="http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement" target="_top">scope(exit)</a>
+ construct of the <a href="http://www.digitalmars.com/d/index.html" target="_top">D</a>
+ programming language;
+ </p>
+<p>
+ Pavel Vozenilek and Maxim Yanchenko for reviews of early drafts of the library;
+ </p>
+<p>
+ Steven Watanabe for his valuable ideas;
+ </p>
+<p>
+ Jody Hagins for good comments that helped to significantly improve the documentation;
+ </p>
+<p>
+ Richard Webb for testing the library on MSVC compiler;
+ </p>
+<p>
+ Adam Butcher for a workaround to error C2355 when deducing the type of <code class="computeroutput"><span class="keyword">this</span></code> on some MSVC versions.
+ </p>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/alternatives.html b/libs/scope_exit/doc/html/scope_exit/alternatives.html
index 549af9f164..91f6ba286d 100644
--- a/libs/scope_exit/doc/html/scope_exit/alternatives.html
+++ b/libs/scope_exit/doc/html/scope_exit/alternatives.html
@@ -1,13 +1,13 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Alternatives</title>
+<title>Annex: Alternatives</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
<link rel="prev" href="tutorial.html" title="Tutorial">
-<link rel="next" href="compilers.html" title="Supported Compilers">
+<link rel="next" href="no_variadic_macros.html" title="Annex: No Variadic Macros">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,85 +20,94 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="compilers.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="no_variadic_macros.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
-<div class="section">
+<div class="section scope_exit_alternatives">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="scope_exit.alternatives"></a> Alternatives</h2></div></div></div>
-<a name="alternatives.try_catch"></a><h4>
-<a name="id761016"></a>
- try-catch
+<a name="scope_exit.alternatives"></a><a class="link" href="alternatives.html" title="Annex: Alternatives">Annex: Alternatives</a>
+</h2></div></div></div>
+<p>
+ This section presents some alternative and related work to <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>.
+ </p>
+<h4>
+<a name="scope_exit.alternatives.h0"></a>
+ <span><a name="scope_exit.alternatives.try_catch"></a></span><a class="link" href="alternatives.html#scope_exit.alternatives.try_catch">Try-Catch</a>
</h4>
<p>
- This is an example of using a badly designed <code class="computeroutput"><span class="identifier">File</span></code>
- class. An instance of <code class="computeroutput"><span class="identifier">File</span></code>
- doesn't close a file in a destructor, a programmer is expected to call the
- <code class="computeroutput"><span class="identifier">close</span></code> member function explicitly.
+ This is an example of using a badly designed <code class="computeroutput"><span class="identifier">file</span></code>
+ class. An instance of <code class="computeroutput"><span class="identifier">file</span></code>
+ does not close the file in its destructor, a programmer is expected to call
+ the <code class="computeroutput"><span class="identifier">close</span></code> member function explicitly.
+ For example (see also <a href="../../../example/try_catch.cpp" target="_top"><code class="literal">try_catch.cpp</code></a>):
</p>
-<pre class="programlisting"><span class="identifier">File</span> <span class="identifier">passwd</span><span class="special">;</span>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">file</span> <span class="identifier">passwd</span><span class="special">;</span>
<span class="keyword">try</span> <span class="special">{</span>
<span class="identifier">passwd</span><span class="special">.</span><span class="identifier">open</span><span class="special">(</span><span class="string">"/etc/passwd"</span><span class="special">);</span>
- <span class="comment">// ...
-</span> <span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">();</span>
-<span class="special">}</span>
-<span class="keyword">catch</span><span class="special">(...)</span> <span class="special">{</span>
- <span class="identifier">log</span><span class="special">(</span><span class="string">"could not get user info"</span><span class="special">);</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">())</span>
- <span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">();</span>
+ <span class="comment">// ...</span>
+ <span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">();</span>
+<span class="special">}</span> <span class="keyword">catch</span><span class="special">(...)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"could not get user info"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">())</span> <span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">();</span>
<span class="keyword">throw</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
- Note the following:
</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<p>
+ Note the following issues with this approach:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
- the <code class="computeroutput"><span class="identifier">passwd</span></code> object is defined
+ The <code class="computeroutput"><span class="identifier">passwd</span></code> object is defined
outside of the <code class="computeroutput"><span class="keyword">try</span></code> block because
this object is required inside the <code class="computeroutput"><span class="keyword">catch</span></code>
- block to close the file,
+ block to close the file.
</li>
<li class="listitem">
- the <code class="computeroutput"><span class="identifier">passwd</span></code> object is not
+ The <code class="computeroutput"><span class="identifier">passwd</span></code> object is not
fully constructed until after the <code class="computeroutput"><span class="identifier">open</span></code>
- member function returns, and
+ member function returns.
</li>
<li class="listitem">
- if opening throws, the <code class="computeroutput"><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">()</span></code> should not be called, hence the call
+ If opening throws, the <code class="computeroutput"><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">()</span></code> should not be called, hence the call
to <code class="computeroutput"><span class="identifier">passwd</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">()</span></code>.
</li>
-</ul></div>
+</ol></div>
<p>
- <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> doesn't have any of these problems:
+ The <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> approach does not have
+ any of these issues. For example (see also <a href="../../../example/try_catch.cpp" target="_top"><code class="literal">try_catch.cpp</code></a>):
</p>
+<p>
+</p>
<pre class="programlisting"><span class="keyword">try</span> <span class="special">{</span>
- <span class="identifier">File</span> <span class="identifier">passwd</span><span class="special">(</span><span class="string">"/etc/passwd"</span><span class="special">);</span>
- <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span> <span class="special">(&amp;</span><span class="identifier">passwd</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">file</span> <span class="identifier">passwd</span><span class="special">(</span><span class="string">"/etc/passwd"</span><span class="special">);</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(&amp;</span><span class="identifier">passwd</span><span class="special">)</span> <span class="special">{</span>
<span class="identifier">passwd</span><span class="special">.</span><span class="identifier">close</span><span class="special">();</span>
<span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
- <span class="comment">// ...
-</span><span class="special">}</span>
-<span class="keyword">catch</span><span class="special">(...)</span> <span class="special">{</span>
- <span class="identifier">log</span><span class="special">(</span><span class="string">"could not get user info"</span><span class="special">);</span>
+<span class="special">}</span> <span class="keyword">catch</span><span class="special">(...)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"could not get user info"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="keyword">throw</span><span class="special">;</span>
<span class="special">}</span>
</pre>
-<a name="alternatives.raii"></a><h4>
-<a name="id761495"></a>
- RAII
+<p>
+ </p>
+<h4>
+<a name="scope_exit.alternatives.h1"></a>
+ <span><a name="scope_exit.alternatives.raii"></a></span><a class="link" href="alternatives.html#scope_exit.alternatives.raii">RAII</a>
</h4>
<p>
<a href="http://www.research.att.com/~bs/glossary.html#Gresource-acquisition-is-initialization" target="_top">RAII</a>
- is absolutely perfect for the <code class="computeroutput"><span class="identifier">File</span></code>
- class introduced above. Use of a properly designed <code class="computeroutput"><span class="identifier">File</span></code>
+ is absolutely perfect for the <code class="computeroutput"><span class="identifier">file</span></code>
+ class introduced above. Use of a properly designed <code class="computeroutput"><span class="identifier">file</span></code>
class would look like:
</p>
<pre class="programlisting"><span class="keyword">try</span> <span class="special">{</span>
- <span class="identifier">File</span> <span class="identifier">passwd</span><span class="special">(</span><span class="string">"/etc/passwd"</span><span class="special">);</span>
- <span class="comment">// ...
-</span><span class="special">}</span>
-<span class="keyword">catch</span><span class="special">(...)</span> <span class="special">{</span>
- <span class="identifier">log</span><span class="special">(</span><span class="string">"could not get user info"</span><span class="special">);</span>
+ <span class="identifier">file</span> <span class="identifier">passwd</span><span class="special">(</span><span class="string">"/etc/passwd"</span><span class="special">);</span>
+ <span class="comment">// ...</span>
+<span class="special">}</span> <span class="keyword">catch</span><span class="special">(...)</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">clog</span> <span class="special">&lt;&lt;</span> <span class="string">"could not get user info"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="keyword">throw</span><span class="special">;</span>
<span class="special">}</span>
</pre>
@@ -108,20 +117,19 @@
guarantee</a> could introduce a lot of non-reusable <a href="http://www.research.att.com/~bs/glossary.html#Gresource-acquisition-is-initialization" target="_top">RAII</a>
types. For example:
</p>
-<pre class="programlisting"><span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">person</span><span class="special">);</span>
-<span class="identifier">pop_back_if_not_commit</span> <span class="identifier">pop_back_if_not_commit_guard</span><span class="special">(</span><span class="identifier">commit</span><span class="special">,</span> <span class="identifier">m_persons</span><span class="special">);</span>
+<pre class="programlisting"><span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
+<span class="identifier">pop_back_if_not_commit</span> <span class="identifier">pop_back_if_not_commit_guard</span><span class="special">(</span><span class="identifier">commit</span><span class="special">,</span> <span class="identifier">persons_</span><span class="special">);</span>
</pre>
<p>
The <code class="computeroutput"><span class="identifier">pop_back_if_not_commit</span></code>
class is either defined out of the scope or as a local class:
</p>
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">pop_back_if_not_commit</span> <span class="special">{</span>
- <span class="keyword">bool</span> <span class="identifier">m_commit</span><span class="special">;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">Person</span><span class="special">&gt;&amp;</span> <span class="identifier">m_vec</span><span class="special">;</span>
- <span class="comment">// ...
-</span> <span class="special">~</span><span class="identifier">pop_back_if_not_commit</span><span class="special">()</span> <span class="special">{</span>
- <span class="keyword">if</span><span class="special">(!</span><span class="identifier">m_commit</span><span class="special">)</span>
- <span class="identifier">m_vec</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="keyword">bool</span> <span class="identifier">commit_</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">person</span><span class="special">&gt;&amp;</span> <span class="identifier">vec_</span><span class="special">;</span>
+ <span class="comment">// ...</span>
+ <span class="special">~</span><span class="identifier">pop_back_if_not_commit</span><span class="special">()</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit_</span><span class="special">)</span> <span class="identifier">vec_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">};</span>
</pre>
@@ -129,34 +137,39 @@
In some cases <a href="http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee" target="_top">strong
guarantee</a> can be accomplished with standard utilities:
</p>
-<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special">&lt;</span><span class="identifier">Person</span><span class="special">&gt;</span> <span class="identifier">spSuperMan</span><span class="special">(</span><span class="keyword">new</span> <span class="identifier">Superman</span><span class="special">);</span>
-<span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">spSuperMan</span><span class="special">.</span><span class="identifier">get</span><span class="special">());</span>
-<span class="identifier">spSuperMan</span><span class="special">.</span><span class="identifier">release</span><span class="special">();</span> <span class="comment">// m_persons successfully took ownership.
-</span></pre>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special">&lt;</span><span class="identifier">Person</span><span class="special">&gt;</span> <span class="identifier">superman_ptr</span><span class="special">(</span><span class="keyword">new</span> <span class="identifier">superman</span><span class="special">());</span>
+<span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">superman_ptr</span><span class="special">.</span><span class="identifier">get</span><span class="special">());</span>
+<span class="identifier">superman_ptr</span><span class="special">.</span><span class="identifier">release</span><span class="special">();</span> <span class="comment">// persons_ successfully took ownership</span>
+</pre>
<p>
- or with specialized containers such as <a href="../../../../../libs/ptr_container/doc/ptr_container.html" target="_top">Boost
- Pointer Container Library</a> or <a href="../../../../../libs/multi_index/doc/index.html" target="_top">Boost
- Multi-Index Containers Library</a>.
+ Or with specialized containers such as <a href="http://www.boost.org/libs/ptr_container" target="_top">Boost.PointerContainer</a>
+ or <a href="http://www.boost.org/libs/multi_index" target="_top">Boost.Multi-Index</a>.
</p>
-<a name="alternatives._ulink_url__http___www_ddj_com_dept_cpp_184403758__scopeguard__ulink_"></a><h4>
-<a name="id761994"></a>
- <a href="http://www.ddj.com/dept/cpp/184403758" target="_top">ScopeGuard</a>
+<h4>
+<a name="scope_exit.alternatives.h2"></a>
+ <span><a name="scope_exit.alternatives.scope_guards"></a></span><a class="link" href="alternatives.html#scope_exit.alternatives.scope_guards">Scope
+ Guards</a>
</h4>
<p>
- Imagine that you add a new currency rate:
+ Imagine that a new currency rate is introduced before performing a transaction
+ (see also []):
</p>
+<p>
+</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">currency</span><span class="special">(</span><span class="string">"EUR"</span><span class="special">);</span>
<span class="keyword">double</span> <span class="identifier">rate</span> <span class="special">=</span> <span class="number">1.3326</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">rates</span><span class="special">;</span>
<span class="keyword">bool</span> <span class="identifier">currency_rate_inserted</span> <span class="special">=</span>
- <span class="identifier">rates</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">currency</span><span class="special">,</span> <span class="identifier">rate</span><span class="special">)).</span><span class="identifier">second</span><span class="special">;</span>
+ <span class="identifier">rates</span><span class="special">.</span><span class="identifier">insert</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span><span class="identifier">currency</span><span class="special">,</span> <span class="identifier">rate</span><span class="special">)).</span><span class="identifier">second</span><span class="special">;</span>
+<span class="comment">// Transaction...</span>
</pre>
<p>
- and then continue a transaction. If it cannot be completed, you erase the currency
- from <code class="computeroutput"><span class="identifier">rates</span></code>. This is how you
- can do this with <a href="http://www.ddj.com/dept/cpp/184403758" target="_top">ScopeGuard</a>
- and <a href="../../../../../libs/lambda/index.html" target="_top">Boost.Lambda</a>:
+ </p>
+<p>
+ If the transaction does not complete, the currency must be erased from <code class="computeroutput"><span class="identifier">rates</span></code>. This can be done with <a href="http://www.ddj.com/dept/cpp/184403758" target="_top">ScopeGuard</a>
+ and <a href="http://www.boost.org/libs/lambda" target="_top">Boost.Lambda</a> (or
+ <a href="http://www.boost.org/libs/phoenix" target="_top">Boost.Phoenix</a>):
</p>
<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">;</span>
@@ -164,140 +177,142 @@
<span class="identifier">if_</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">_1</span><span class="special">)</span> <span class="special">[</span>
<span class="identifier">bind</span><span class="special">(</span>
<span class="keyword">static_cast</span><span class="special">&lt;</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span><span class="keyword">double</span><span class="special">&gt;::</span><span class="identifier">size_type</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span><span class="keyword">double</span><span class="special">&gt;::*)(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span><span class="special">&amp;)</span>
- <span class="special">&gt;(&amp;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span><span class="keyword">double</span><span class="special">&gt;::</span><span class="identifier">erase</span><span class="special">)</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&gt;::</span><span class="identifier">size_type</span>
+ <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&gt;::*)(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span><span class="special">&amp;)</span>
+ <span class="special">&gt;(&amp;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">,</span> <span class="keyword">double</span><span class="special">&gt;::</span><span class="identifier">erase</span><span class="special">)</span>
<span class="special">,</span> <span class="special">&amp;</span><span class="identifier">rates</span>
<span class="special">,</span> <span class="identifier">currency</span>
- <span class="special">)</span>
+ <span class="special">)</span>
<span class="special">]</span>
<span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">cref</span><span class="special">(</span><span class="identifier">commit</span><span class="special">)</span>
<span class="special">);</span>
-<span class="comment">// ...
-</span>
+<span class="comment">// ...</span>
+
<span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
</pre>
<p>
- Note that
+ Note the following issues with this approach:
</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
- Boost.lambda expressions are hard to write correctly, for example, overloaded
- function must be explicitly casted, as demonstrated in this example,
+ <a href="http://www.boost.org/libs/lambda" target="_top">Boost.Lambda</a> expressions
+ are hard to write correctly (e.g., overloaded functions must be explicitly
+ casted, as demonstrated in the example above).
</li>
<li class="listitem">
- condition in <code class="computeroutput"><span class="identifier">if_</span></code> expression
- refers to <code class="computeroutput"><span class="identifier">commit</span></code> variable
- indirectly through the <code class="computeroutput"><span class="identifier">_1</span></code>
- placeholder,
+ The condition in the <code class="computeroutput"><span class="identifier">if_</span></code>
+ expression refers to <code class="computeroutput"><span class="identifier">commit</span></code>
+ variable indirectly through the <code class="computeroutput"><span class="identifier">_1</span></code>
+ placeholder reducing readability.
</li>
<li class="listitem">
- setting a breakpoint inside <code class="computeroutput"><span class="identifier">if_</span><span class="special">[</span> <span class="special">...</span> <span class="special">]</span></code>
- requires in-depth knowledge of <a href="../../../../../libs/lambda/index.html" target="_top">Boost.Lambda</a>
- and debugging techniques.
+ Setting a breakpoint inside <code class="computeroutput"><span class="identifier">if_</span><span class="special">[...]</span></code> requires in-depth knowledge of <a href="http://www.boost.org/libs/lambda" target="_top">Boost.Lambda</a> and debugging
+ techniques.
</li>
-</ul></div>
+</ol></div>
<p>
- This code will look much better with native lambda expressions proposed for
- C++0x:
+ This code will look much better with C++11 lambdas:
</p>
<pre class="programlisting"><span class="identifier">ON_BLOCK_EXIT</span><span class="special">(</span>
- <span class="special">[</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">currency</span><span class="special">]()</span> <span class="special">-&gt;</span> <span class="keyword">void</span>
- <span class="special">{</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span>
- <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
+ <span class="special">[</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">currency</span><span class="special">]()</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">);</span>
+
+<span class="comment">// ...</span>
+
+<span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
</pre>
<p>
- With <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> you can simply do
+ With <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> we can simply do the
+ following (see also <a href="../../../example/scope_guard.cpp" target="_top"><code class="literal">scope_guard.cpp</code></a>):
</p>
-<pre class="programlisting"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">currency_rate_inserted</span><span class="special">)(&amp;</span><span class="identifier">commit</span><span class="special">)(&amp;</span><span class="identifier">rates</span><span class="special">)(&amp;</span><span class="identifier">currency</span><span class="special">)</span> <span class="special">)</span>
-<span class="special">{</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span>
- <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">currency</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
<span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
-<span class="comment">// ...
-</span>
+<span class="comment">// ...</span>
+
<span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
</pre>
-<a name="alternatives.c__0x"></a><h4>
-<a name="id762994"></a>
- C++0x
- </h4>
<p>
- In future releases <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> will take advantages
- of C++0x features.
</p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
- Passing capture list as <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor
- sequence</a> will be replaced with a traditional macro invocation style:
- </li></ul></div>
-<pre class="programlisting"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">currency</span><span class="special">)</span>
-<span class="special">{</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span>
- <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
-<span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
-</pre>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
- <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT_END</span></code> will
- be replaced with a semicolon:
- </li></ul></div>
-<pre class="programlisting"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">rates</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">currency</span><span class="special">)</span>
-<span class="special">{</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span>
- <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
-<span class="special">};</span>
-</pre>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
- Users will be able to capture local variables implicitly with lambda capture
- defaults <code class="computeroutput"><span class="special">&amp;</span></code> and <code class="computeroutput"><span class="special">=</span></code>:
- </li></ul></div>
-<pre class="programlisting"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(&amp;,</span> <span class="identifier">currency_rate_inserted</span><span class="special">)</span>
-<span class="special">{</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">currency_rate_inserted</span> <span class="special">&amp;&amp;</span> <span class="special">!</span><span class="identifier">commit</span><span class="special">)</span>
- <span class="identifier">rates</span><span class="special">.</span><span class="identifier">erase</span><span class="special">(</span><span class="identifier">currency</span><span class="special">);</span>
-<span class="special">};</span>
-</pre>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
- It will be possible to capture <code class="computeroutput"><span class="keyword">this</span></code>
- pointer.
- </li></ul></div>
-<a name="alternatives.the_d_programming_language"></a><h4>
-<a name="id763445"></a>
- The D Programming Language
+<h4>
+<a name="scope_exit.alternatives.h3"></a>
+ <span><a name="scope_exit.alternatives.the_d_programming_language"></a></span><a class="link" href="alternatives.html#scope_exit.alternatives.the_d_programming_language">The
+ D Programming Language</a>
</h4>
<p>
- <span class="underline">ScopeExit</span> is similar to <a href="http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement" target="_top">scope(exit)</a>
+ <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> is similar to <a href="http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement" target="_top">scope(exit)</a>
feature built into the <a href="http://www.digitalmars.com/d/index.html" target="_top">D</a>
programming language.
</p>
<p>
- A curious reader may notice that the library doesn't implement <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">success</span><span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">failure</span><span class="special">)</span></code> of the <a href="http://www.digitalmars.com/d/index.html" target="_top">D</a>
- language. Unfortunately, it's not possible in C++ because failure or success
- condition cannot be determined by calling <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code>.
- It's not a big problem, though. These two constructs can be expressed in terms
- of <a href="http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement" target="_top">scope(exit)</a>
+ A curious reader may notice that the library does not implement <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">success</span><span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">scope</span><span class="special">(</span><span class="identifier">failure</span><span class="special">)</span></code> of the <a href="http://www.digitalmars.com/d/index.html" target="_top">D</a>
+ language. Unfortunately, these are not possible in C++ because failure or success
+ conditions cannot be determined by calling <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code>
+ (see <a href="http://www.gotw.ca/gotw/047.htm" target="_top">Guru of the Week #47</a>
+ for details about <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code> and if it has any good
+ use at all). However, this is not a big problem because these two <a href="http://www.digitalmars.com/d/index.html" target="_top">D</a>'s
+ constructs can be expressed in terms of <a href="http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement" target="_top">scope(exit)</a>
and a <code class="computeroutput"><span class="keyword">bool</span> <span class="identifier">commit</span></code>
- variable as explained in <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>.
- Refer to <a href="http://www.gotw.ca/gotw/047.htm" target="_top">Guru of the Week #47</a>
- for more details about <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">uncaught_exception</span></code>
- and if it has any good use at all.
+ variable (similarly to some examples presented in the <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+ section).
+ </p>
+<h4>
+<a name="scope_exit.alternatives.h4"></a>
+ <span><a name="scope_exit.alternatives.c__11_lambdas"></a></span><a class="link" href="alternatives.html#scope_exit.alternatives.c__11_lambdas">C++11
+ Lambdas</a>
+ </h4>
+<p>
+ Using C++11 lambdas, it is relatively easy to implement the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ construct. For example (see also <a href="../../../example/world_cxx11_lambda.cpp" target="_top"><code class="literal">world_cxx11_lambda.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">functional</span><span class="special">&gt;</span>
+
+<span class="keyword">struct</span> <span class="identifier">scope_exit</span> <span class="special">{</span>
+ <span class="identifier">scope_exit</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)&gt;</span> <span class="identifier">f</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">f_</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span> <span class="special">{}</span>
+ <span class="special">~</span><span class="identifier">scope_exit</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">f_</span><span class="special">();</span> <span class="special">}</span>
+<span class="keyword">private</span><span class="special">:</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">function</span><span class="special">&lt;</span><span class="keyword">void</span> <span class="special">(</span><span class="keyword">void</span><span class="special">)&gt;</span> <span class="identifier">f_</span><span class="special">;</span>
+<span class="special">};</span>
+
+<span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
+ <span class="identifier">scope_exit</span> <span class="identifier">on_exit1</span><span class="special">([&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="keyword">this</span><span class="special">](</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Use C++11 lambda.</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span> <span class="comment">// `persons_` via captured `this`.</span>
+ <span class="special">});</span>
+
+ <span class="comment">// ...</span>
+
+ <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ However, this library allows to program the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ construct in a way that is portable between C++03 and C++11 compilers.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2006 -2009 Alexander Nasonov<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
- http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="compilers.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="no_variadic_macros.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/compilers.html b/libs/scope_exit/doc/html/scope_exit/compilers.html
deleted file mode 100644
index 39f8886980..0000000000
--- a/libs/scope_exit/doc/html/scope_exit/compilers.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Supported Compilers</title>
-<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="prev" href="alternatives.html" title="Alternatives">
-<link rel="next" href="conf.html" title="Configuration">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
-<td align="center"><a href="../../../../../index.html">Home</a></td>
-<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
-<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
-<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
-<td align="center"><a href="../../../../../more/index.htm">More</a></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="conf.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="scope_exit.compilers"></a> Supported Compilers</h2></div></div></div>
-<p>
- The library should be usable on any compiler that supports <a href="../../../../../libs/typeof/index.html" target="_top">Boost.Typeof</a>
- except
- </p>
-<div class="itemizedlist"><ul class="itemizedlist" type="disc">
-<li class="listitem">
- MSVC 7.1 and 8.0 fail to link if a function with <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a>
- is included by multiple translation units.
- </li>
-<li class="listitem">
- GCC 3.3 can't compile <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> inside
- a template. See <a href="http://lists.boost.org/Archives/boost/2007/02/116235.php" target="_top">this
- thread</a> for more details.
- </li>
-</ul></div>
-<p>
- The author tested the library on GCC 3.3, 3.4, 4.1, 4.2 and Intel 10.1.
- </p>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2006 -2009 Alexander Nasonov<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
- http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="conf.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/conf.html b/libs/scope_exit/doc/html/scope_exit/conf.html
deleted file mode 100644
index a3b504d5a1..0000000000
--- a/libs/scope_exit/doc/html/scope_exit/conf.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Configuration</title>
-<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="prev" href="compilers.html" title="Supported Compilers">
-<link rel="next" href="ref.html" title="Reference">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
-<td align="center"><a href="../../../../../index.html">Home</a></td>
-<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
-<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
-<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
-<td align="center"><a href="../../../../../more/index.htm">More</a></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="compilers.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ref.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="scope_exit.conf"></a> Configuration</h2></div></div></div>
-<p>
- Normally, no configuration is required for the library but note that the library
- depends on <a href="../../../../../libs/typeof/index.html" target="_top">Boost.Typeof</a>
- and you may want to configure or enforce <a href="../../../../../libs/typeof/index.html" target="_top">typeof
- emulation</a>.
- </p>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2006 -2009 Alexander Nasonov<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
- http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="compilers.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ref.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/getting_started.html b/libs/scope_exit/doc/html/scope_exit/getting_started.html
new file mode 100644
index 0000000000..7a51381d8c
--- /dev/null
+++ b/libs/scope_exit/doc/html/scope_exit/getting_started.html
@@ -0,0 +1,138 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Getting Started</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="prev" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="next" href="tutorial.html" title="Tutorial">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section scope_exit_getting_started">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="scope_exit.getting_started"></a><a class="link" href="getting_started.html" title="Getting Started">Getting Started</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="getting_started.html#scope_exit.getting_started.this_documentation">This Documentation</a></span></dt>
+<dt><span class="section"><a href="getting_started.html#scope_exit.getting_started.compilers_and_platforms">Compilers
+ and Platforms</a></span></dt>
+<dt><span class="section"><a href="getting_started.html#scope_exit.getting_started.installation">Installation</a></span></dt>
+</dl></div>
+<p>
+ This section explains how to setup a system to use this library.
+ </p>
+<div class="section scope_exit_getting_started_this_documentation">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.getting_started.this_documentation"></a><a class="link" href="getting_started.html#scope_exit.getting_started.this_documentation" title="This Documentation">This Documentation</a>
+</h3></div></div></div>
+<p>
+ Programmers should have enough knowledge to use this library after reading
+ the <a class="link" href="../index.html#scope_exit.introduction" title="Introduction">Introduction</a>, <a class="link" href="getting_started.html" title="Getting Started">Getting
+ Started</a>, and <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a> sections.
+ The <a href="../reference.html" target="_top">Reference</a> section can be consulted
+ at a later point for quick reference. All the other sections of this documentation
+ can be considered optional.
+ </p>
+<p>
+ Some footnotes are marked by the word "<span class="bold"><strong>Rationale</strong></span>".
+ They explain reasons behind decisions made during the design and implementation
+ of this library.
+ </p>
+<p>
+ In most of the examples presented in this documentation, the Boost.Detail/LightweightTest
+ (<code class="literal">boost/detail/lightweight_test.hpp</code>) macro <code class="computeroutput"><span class="identifier">BOOST_TEST</span></code> is used to check correctness
+ conditions. The <code class="computeroutput"><span class="identifier">BOOST_TEST</span></code>
+ macro is conceptually similar to <code class="computeroutput"><span class="identifier">assert</span></code>
+ but a failure of the checked condition does not abort the program, instead
+ it makes <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span></code> return a non-zero program
+ exit code. <sup>[<a name="scope_exit.getting_started.this_documentation.f0" href="#ftn.scope_exit.getting_started.this_documentation.f0" class="footnote">2</a>]</sup>
+ </p>
+</div>
+<div class="section scope_exit_getting_started_compilers_and_platforms">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.getting_started.compilers_and_platforms"></a><a class="link" href="getting_started.html#scope_exit.getting_started.compilers_and_platforms" title="Compilers and Platforms">Compilers
+ and Platforms</a>
+</h3></div></div></div>
+<p>
+ The authors originally developed and tested the library on GNU Compiler Collection
+ (GCC) C++ 3.3, 3.4, 4.1, 4.2, 4.5.3 (with and without C++11 features <code class="literal">-std=c++0x</code>),
+ Microsoft Visual C++ (MSVC) 8.0, and Intel 10.1 under Linux, Cygwin, and
+ Windows 7. However, this library should be usable on any compiler that supports
+ <a href="http://www.boost.org/libs/typeof" target="_top">Boost.Typeof</a> except:
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ MSVC 7.1 and 8.0 fail to link if a function with <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ is included by multiple translation units.
+ </li>
+<li class="listitem">
+ GCC 3.3 cannot compile <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ inside a template (see <a href="http://lists.boost.org/Archives/boost/2007/02/116235.php" target="_top">http://lists.boost.org/Archives/boost/2007/02/116235.php</a>
+ for details).
+ </li>
+</ul></div>
+<p>
+ See the library <a href="http://www.boost.org/development/tests/release/developer/scope_exit.html" target="_top">regression
+ test results</a> for detailed information on supported compilers and
+ platforms. Check the library regression test <a href="../../../test/Jamfile.v2" target="_top"><code class="literal">Jamfile.v2</code></a>
+ for any special configuration that might be required for a specific compiler.
+ </p>
+</div>
+<div class="section scope_exit_getting_started_installation">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.getting_started.installation"></a><a class="link" href="getting_started.html#scope_exit.getting_started.installation" title="Installation">Installation</a>
+</h3></div></div></div>
+<p>
+ This library is composed of header files only. Therefore there is no pre-compiled
+ object file which needs to be installed. Programmers can simply instruct
+ the compiler where to find the library header files (<code class="computeroutput"><span class="special">-</span><span class="identifier">I</span></code> option on GCC, <code class="computeroutput"><span class="special">/</span><span class="identifier">I</span></code> option on MSVC, etc) and compile code
+ using the library.
+ </p>
+<p>
+ The library implementation uses <a href="http://www.boost.org/libs/typeof" target="_top">Boost.Typeof</a>
+ to automatically deduce the types of the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ captured variables (see the <a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+ section). In order to compile code in <a href="http://www.boost.org/libs/typeof" target="_top">type-of
+ emulation</a> mode, all types should be properly registered using <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TYPE</span></code> and <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_REGISTER_TEMPLATE</span></code>, or appropriate
+ <a href="http://www.boost.org/libs/typeof" target="_top">Boost.Typeof</a> headers
+ should be included (see the source code of most examples presented in this
+ documentation).
+ </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.getting_started.this_documentation.f0" href="#scope_exit.getting_started.this_documentation.f0" class="para">2</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> Using Boost.Detail/LightweightTest
+ allows to add the examples to the library regression tests so to make sure
+ that they always compile and run correctly.
+ </p></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/no_variadic_macros.html b/libs/scope_exit/doc/html/scope_exit/no_variadic_macros.html
new file mode 100644
index 0000000000..cf28f1e811
--- /dev/null
+++ b/libs/scope_exit/doc/html/scope_exit/no_variadic_macros.html
@@ -0,0 +1,229 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Annex: No Variadic Macros</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="prev" href="alternatives.html" title="Annex: Alternatives">
+<link rel="next" href="../reference.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center"><a href="../../../../../index.html">Home</a></td>
+<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
+<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
+<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
+<td align="center"><a href="../../../../../more/index.htm">More</a></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section scope_exit_no_variadic_macros">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="scope_exit.no_variadic_macros"></a><a class="link" href="no_variadic_macros.html" title="Annex: No Variadic Macros">Annex: No Variadic Macros</a>
+</h2></div></div></div>
+<p>
+ This section presents an alternative syntax for compilers without variadic
+ macro support.
+ </p>
+<h4>
+<a name="scope_exit.no_variadic_macros.h0"></a>
+ <span><a name="scope_exit.no_variadic_macros.sequence_syntax"></a></span><a class="link" href="no_variadic_macros.html#scope_exit.no_variadic_macros.sequence_syntax">Sequence
+ Syntax</a>
+ </h4>
+<p>
+ Most modern compilers support variadic macros (notably, these include GCC,
+ MSVC, and all C++11 compilers). <sup>[<a name="scope_exit.no_variadic_macros.f0" href="#ftn.scope_exit.no_variadic_macros.f0" class="footnote">10</a>]</sup> However, in the rare case that programmers need to use this library
+ on a complier without variaidc macros, this library also allows to specify
+ the capture list using a <a href="http://www.boost.org/libs/preprocessor" target="_top">Boost.Preprocessor</a>
+ sequence where tokens are separated by round parenthesis <code class="computeroutput"><span class="special">()</span></code>:
+ </p>
+<pre class="programlisting"><span class="special">(</span><span class="identifier">capture1</span><span class="special">)</span> <span class="special">(</span><span class="identifier">capture2</span><span class="special">)</span> <span class="special">...</span> <span class="comment">// All compilers.</span>
+</pre>
+<p>
+ Instead of the comma-separated list that we have seen so far which requires
+ variadic macros:
+ </p>
+<pre class="programlisting"><span class="identifier">capture1</span><span class="special">,</span> <span class="identifier">capture2</span><span class="special">,</span> <span class="special">...</span> <span class="comment">// Only compilers with variadic macros.</span>
+</pre>
+<p>
+ For example, the following syntax is accepted on all compilers with and without
+ variadic macros (see also <a href="../../../test/world_seq.cpp" target="_top"><code class="literal">world_seq.cpp</code></a>
+ and <a href="../../../test/world.cpp" target="_top"><code class="literal">world.cpp</code></a>):
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Boost.Preprocessor Sequence (All Compilers)
+ </p>
+ </th>
+<th>
+ <p>
+ Comma-Separated List (Variadic Macros Only)
+ </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="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span> <span class="comment">// (1) direct action</span>
+ <span class="comment">// Following block is executed when the enclosing scope exits.</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span> <span class="special">(&amp;</span><span class="identifier">commit</span><span class="special">)</span> <span class="special">(&amp;</span><span class="identifier">persons_</span><span class="special">)</span> <span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span> <span class="comment">// (2) rollback action</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+
+ <span class="comment">// ... // (3) other operations</span>
+
+ <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span> <span class="comment">// (4) disable rollback actions</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="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span> <span class="comment">// (1) direct action</span>
+ <span class="comment">// Following block is executed when the enclosing scope exits.</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">persons_</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span> <span class="comment">// (2) rollback action</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+
+ <span class="comment">// ... // (3) other operations</span>
+
+ <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span> <span class="comment">// (4) disable rollback actions</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+ </td>
+</tr></tbody>
+</table></div>
+<p>
+ Note how the same macros accept both syntaxes on compilers with variadic macros
+ and only the <a href="http://www.boost.org/libs/preprocessor" target="_top">Boost.Preprocessor</a>
+ sequence syntax on compilers without variadic macros. Older versions of this
+ library used to only support the <a href="http://www.boost.org/libs/preprocessor" target="_top">Boost.Preprocessor</a>
+ sequence syntax so this syntax is supported also for backward compatibility.
+ However, in the current version of this library and on compilers with variadic
+ macros, the comma-separated syntax is preferred because it is more readable.
+ </p>
+<p>
+ Finally, an empty capture list is always specified using <code class="computeroutput"><span class="keyword">void</span></code>
+ on compilers with and without variaidc macros (see also <a href="../../../test/world_void.cpp" target="_top"><code class="literal">world_void.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">world_t</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">person</span><span class="special">&gt;</span> <span class="identifier">persons</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span><span class="special">;</span>
+<span class="special">}</span> <span class="identifier">world</span><span class="special">;</span> <span class="comment">// Global variable.</span>
+
+<span class="keyword">void</span> <span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
+
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// No captures.</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">world</span><span class="special">.</span><span class="identifier">persons</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+
+ <span class="comment">// ...</span>
+
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<h4>
+<a name="scope_exit.no_variadic_macros.h1"></a>
+ <span><a name="scope_exit.no_variadic_macros.examples"></a></span><a class="link" href="no_variadic_macros.html#scope_exit.no_variadic_macros.examples">Examples</a>
+ </h4>
+<p>
+ For reference, the following is a list of most of the examples presented in
+ this documentation reprogrammed using the <a href="http://www.boost.org/libs/preprocessor" target="_top">Boost.Preprocessor</a>
+ sequence syntax instead of comma-separated lists (in alphabetic order):
+ </p>
+<div class="informaltable"><table class="table">
+<colgroup><col></colgroup>
+<thead><tr><th>
+ <p>
+ Files
+ </p>
+ </th></tr></thead>
+<tbody>
+<tr><td>
+ <p>
+ <a href="../../../test/same_line_seq.cpp" target="_top"><code class="literal">same_line_seq.cpp</code></a>
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ <a href="../../../example/scope_guard_seq.cpp" target="_top"><code class="literal">scope_guard_seq.cpp</code></a>
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ <a href="../../../example/try_catch_seq.cpp" target="_top"><code class="literal">try_catch_seq.cpp</code></a>
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ <a href="../../../test/world_checkpoint_all_seq.cpp" target="_top"><code class="literal">world_checkpoint_all_seq.cpp</code></a>
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ <a href="../../../test/world_checkpoint_seq.cpp" target="_top"><code class="literal">world_checkpoint_seq.cpp</code></a>
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ <a href="../../../test/world_this_seq.cpp" target="_top"><code class="literal">world_this_seq.cpp</code></a>
+ </p>
+ </td></tr>
+<tr><td>
+ <p>
+ <a href="../../../test/world_tpl_seq.cpp" target="_top"><code class="literal">world_tpl_seq.cpp</code></a>
+ </p>
+ </td></tr>
+</tbody>
+</table></div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.no_variadic_macros.f0" href="#scope_exit.no_variadic_macros.f0" class="para">10</a>] </sup>
+ A C++ compiler does not support variadic macros if the <a href="http://www.boost.org/libs/config" target="_top">Boost.Config</a>
+ macro <code class="computeroutput"><span class="identifier">BOOST_NO_VARIADIC_MACROS</span></code>
+ is defined for that compiler.
+ </p></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="alternatives.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/ref.html b/libs/scope_exit/doc/html/scope_exit/ref.html
deleted file mode 100644
index ef783c01e9..0000000000
--- a/libs/scope_exit/doc/html/scope_exit/ref.html
+++ /dev/null
@@ -1,153 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
-<title>Reference</title>
-<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="prev" href="conf.html" title="Configuration">
-<link rel="next" href="acknowledge.html" title="Acknowledge">
-</head>
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
-<table cellpadding="2" width="100%"><tr>
-<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
-<td align="center"><a href="../../../../../index.html">Home</a></td>
-<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
-<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
-<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
-<td align="center"><a href="../../../../../more/index.htm">More</a></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="conf.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledge.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
-</div>
-<div class="section">
-<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="scope_exit.ref"></a> Reference</h2></div></div></div>
-<a name="ref.boost_scope_exit"></a><h4>
-<a name="id763687"></a>
- BOOST_SCOPE_EXIT
- </h4>
-<p>
- A <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> declaration has the following
- synopsis:
- </p>
-<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">scope_exit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
-
-<span class="identifier">BOOST_SCOPE_EXIT</span> <span class="special">(</span> <span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">-</span><span class="identifier">list</span> <span class="special">)</span>
- <span class="identifier">function</span><span class="special">-</span><span class="identifier">body</span>
-<span class="identifier">BOOST_SCOPE_EXIT_END</span>
-</pre>
-<p>
- where
- </p>
-<pre class="programlisting"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">-</span><span class="identifier">list</span><span class="special">:</span>
- <span class="special">(</span> <span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span> <span class="special">)</span>
- <span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">-</span><span class="identifier">list</span> <span class="special">(</span> <span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span> <span class="special">)</span>
-
-<span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">:</span>
- <span class="identifier">identifier</span>
- <span class="special">&amp;</span><span class="identifier">identifier</span>
-</pre>
-<p>
- The <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> declaration schedules an execution
- of <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">body</span></code>
- at the end of the current scope. The <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">body</span></code> statements are executed in the reverse
- order of <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> declarations in the given
- scope. The scope must be local.
- </p>
-<p>
- Each <code class="computeroutput"><span class="identifier">identifier</span></code> in <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">-</span><span class="identifier">list</span></code> must
- be a valid name in enclosing scope and it must appear exactly once in the list.
- If a <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span></code>
- starts with the ampersand sign <code class="computeroutput"><span class="special">&amp;</span></code>,
- the corresponding <code class="computeroutput"><span class="identifier">identifier</span></code>
- will be available inside <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">body</span></code>; otherwise, a copy of it will be made
- at the point of <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> declaration and
- that copy will be available inside <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">body</span></code>. In the latter case, the <code class="computeroutput"><span class="identifier">idenitifer</span></code> must be <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>.
- </p>
-<p>
- Only identifiers listed in <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">-</span><span class="identifier">list</span></code>, static variables, <code class="computeroutput"><span class="keyword">extern</span></code>
- variables and functions, and enumerations from the enclosing scope can be used
- inside the <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">body</span></code>.
- </p>
-<div class="note"><table border="0" summary="Note">
-<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
-<th align="left">Note</th>
-</tr>
-<tr><td align="left" valign="top"><p>
- <code class="computeroutput"><span class="keyword">this</span></code> pointer is not an identifier
- and cannot be passed to <code class="computeroutput"> <span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">-</span><span class="identifier">list</span></code>.
- </p></td></tr>
-</table></div>
-<p>
- The <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> uses <a href="../../../../../libs/typeof/index.html" target="_top">Boost.Typeof</a>
- to determine types of <code class="computeroutput"><span class="identifier">scope</span><span class="special">-</span><span class="identifier">exit</span><span class="special">-</span><span class="identifier">capture</span><span class="special">-</span><span class="identifier">list</span></code> elements. In order to compile code in
- <a href="../../../../../libs/typeof/index.html" target="_top">typeof emulation</a> mode,
- all types should be registered with <a href="../../../../../doc/html/typeof/refe.html#typeof.regtype" target="_top">BOOST_TYPEOF_REGISTER_TYPE</a>
- or <a href="../../../../../doc/html/typeof/refe.html#typeof.regtemp" target="_top">BOOST_TYPEOF_REGISTER_TEMPLATE</a>
- macros, or appropriate <a href="../../../../../libs/typeof/index.html" target="_top">Boost.Typeof</a>
- headers should be included.
- </p>
-<a name="ref.boost_scope_exit_tpl"></a><h4>
-<a name="id764391"></a>
- BOOST_SCOPE_EXIT_TPL
- </h4>
-<p>
- This macro is a workaround for various versions of gcc. These compilers don't
- compile <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> declaration inside function
- templates. As a workaround, the <code class="computeroutput"><span class="identifier">_TPL</span></code>
- suffix should be appended to <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span></code>.
- </p>
-<p>
- The problem boils down to the following code:
- </p>
-<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">t</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">0</span><span class="special">;</span>
- <span class="keyword">struct</span> <span class="identifier">Local</span> <span class="special">{</span>
- <span class="keyword">typedef</span> <span class="identifier">__typeof__</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span> <span class="identifier">typeof_i</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">__typeof__</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span> <span class="identifier">typeof_t</span><span class="special">;</span>
- <span class="special">};</span>
- <span class="keyword">typedef</span> <span class="identifier">Local</span><span class="special">::</span><span class="identifier">typeof_i</span> <span class="identifier">i_type</span><span class="special">;</span>
- <span class="keyword">typedef</span> <span class="identifier">Local</span><span class="special">::</span><span class="identifier">typeof_t</span> <span class="identifier">t_type</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">foo</span><span class="special">(</span><span class="number">0</span><span class="special">);</span> <span class="special">}</span>
-</pre>
-<p>
- This can be fixed by adding <code class="computeroutput"><span class="keyword">typename</span></code>
- in front of <code class="computeroutput"><span class="identifier">Local</span><span class="special">::</span><span class="identifier">typeof_i</span></code> and <code class="computeroutput"><span class="identifier">Local</span><span class="special">::</span><span class="identifier">typeof_t</span></code>.
- </p>
-<p>
- See also <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37920" target="_top">GCC
- bug 37920</a>.
- </p>
-<div class="note"><table border="0" summary="Note">
-<tr>
-<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
-<th align="left">Note</th>
-</tr>
-<tr><td align="left" valign="top"><p>
- Although <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT_TPL</span></code>
- has the same suffix as the <code class="computeroutput"><span class="identifier">BOOST_TYPEOF_TPL</span></code>,
- it doesn't follow a convention of the <a href="../../../../../libs/typeof/index.html" target="_top">Boost.Typeof</a>.
- </p></td></tr>
-</table></div>
-</div>
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2006 -2009 Alexander Nasonov<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
- http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
- </p>
-</div></td>
-</tr></table>
-<hr>
-<div class="spirit-nav">
-<a accesskey="p" href="conf.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="acknowledge.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
-</div>
-</body>
-</html>
diff --git a/libs/scope_exit/doc/html/scope_exit/tutorial.html b/libs/scope_exit/doc/html/scope_exit/tutorial.html
index 8668d4227a..6db2ec2950 100644
--- a/libs/scope_exit/doc/html/scope_exit/tutorial.html
+++ b/libs/scope_exit/doc/html/scope_exit/tutorial.html
@@ -3,11 +3,11 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Tutorial</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
-<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="prev" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">
-<link rel="next" href="alternatives.html" title="Alternatives">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">
+<link rel="prev" href="getting_started.html" title="Getting Started">
+<link rel="next" href="alternatives.html" title="Annex: Alternatives">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
@@ -20,132 +20,558 @@
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alternatives.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="getting_started.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alternatives.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
-<div class="section">
+<div class="section scope_exit_tutorial">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="scope_exit.tutorial"></a> Tutorial</h2></div></div></div>
+<a name="scope_exit.tutorial"></a><a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="tutorial.html#scope_exit.tutorial.capturing_variables">Capturing Variables</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#scope_exit.tutorial.capturing_the_object__this_">Capturing
+ The Object <code class="computeroutput"><span class="keyword">this</span></code></a></span></dt>
+<dt><span class="section"><a href="tutorial.html#scope_exit.tutorial.capturing_no_variable">Capturing
+ No Variable</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#scope_exit.tutorial.capturing_all_variables__c__11_only_">Capturing
+ All Variables (C++11 Only)</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#scope_exit.tutorial.template_workaround__gcc_">Template
+ Workaround (GCC)</a></span></dt>
+<dt><span class="section"><a href="tutorial.html#scope_exit.tutorial.same_line_expansions">Same Line Expansions</a></span></dt>
+</dl></div>
<p>
- Imagine that you want to make many modifications to data members of the <code class="computeroutput"><span class="identifier">World</span></code> class in the <code class="computeroutput"><span class="identifier">World</span><span class="special">::</span><span class="identifier">addPerson</span></code>
- function. You start with adding a new <code class="computeroutput"><span class="identifier">Person</span></code>
- object to a vector of persons:
+ This section illustrates how to use this library.
</p>
-<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">World</span><span class="special">::</span><span class="identifier">addPerson</span><span class="special">(</span><span class="identifier">Person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">person</span><span class="special">)</span> <span class="special">{</span>
+<div class="section scope_exit_tutorial_capturing_variables">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.tutorial.capturing_variables"></a><a class="link" href="tutorial.html#scope_exit.tutorial.capturing_variables" title="Capturing Variables">Capturing Variables</a>
+</h3></div></div></div>
+<p>
+ Imagine that we want to make many modifications to data members of some
+ <code class="computeroutput"><span class="identifier">world</span></code> class in its <code class="computeroutput"><span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span></code> member function. We start with
+ adding a new <code class="computeroutput"><span class="identifier">person</span></code> object
+ to a vector of persons:
+ </p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
<span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
- <span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">person</span><span class="special">);</span> <span class="comment">// (1) direct action
-</span></pre>
+
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span> <span class="comment">// (1) direct action</span>
+ <span class="special">...</span>
+</pre>
<p>
- Some operation down the road may throw an exception and all changes to involved
- objects should be rolled back. This all-or-nothing semantic is also known as
- <a href="http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee" target="_top">strong
- guarantee</a>.
- </p>
+ Some operations down the road may throw an exception and all changes to involved
+ objects should be rolled back. This all-or-nothing semantic is also known
+ as <a href="http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee" target="_top">strong
+ guarantee</a>.
+ </p>
<p>
- In particular, last added person must be deleted from <code class="computeroutput"><span class="identifier">m_persons</span></code>
- when the function throws. All you need is to define a delayed action (release
- of a resource) right after the direct action (resource acquisition):
- </p>
-<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">World</span><span class="special">::</span><span class="identifier">addPerson</span><span class="special">(</span><span class="identifier">Person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">aPerson</span><span class="special">)</span> <span class="special">{</span>
+ In particular, the last added person must be deleted from <code class="computeroutput"><span class="identifier">persons_</span></code>
+ if the function throws. All we need is to define a delayed action (release
+ of a resource) right after the direct action (resource acquisition). For
+ example (see also <a href="../../../test/world.cpp" target="_top"><code class="literal">world.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
<span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
- <span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">aPerson</span><span class="special">);</span> <span class="comment">// (1) direct action
-</span> <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span> <span class="special">(&amp;</span><span class="identifier">commit</span><span class="special">)(&amp;</span><span class="identifier">m_persons</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">{</span>
- <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span>
- <span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span> <span class="comment">// (2) rollback action
-</span> <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
-
- <span class="comment">// ... // (3) other operations
-</span>
- <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span> <span class="comment">// (4) turn all rollback actions into no-op
-</span><span class="special">}</span>
+
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span> <span class="comment">// (1) direct action</span>
+ <span class="comment">// Following block is executed when the enclosing scope exits.</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">persons_</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span> <span class="comment">// (2) rollback action</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+
+ <span class="comment">// ... // (3) other operations</span>
+
+ <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span> <span class="comment">// (4) disable rollback actions</span>
+<span class="special">}</span>
</pre>
<p>
- The block below point <code class="computeroutput"><span class="special">(</span><span class="number">1</span><span class="special">)</span></code> is a <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a>
- declaration. Unlike point <code class="computeroutput"><span class="special">(</span><span class="number">1</span><span class="special">)</span></code>, an execution of the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a>
- body will be delayed until the end of the current scope. In this case it will
- be executed either after point <code class="computeroutput"><span class="special">(</span><span class="number">4</span><span class="special">)</span></code> or on any
- exception.
- </p>
+ </p>
<p>
- The <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> declaration starts with <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span></code> macro invocation which accepts
- <a href="../../../../../libs/preprocessor/index.html" target="_top">Boost.Preprocessor sequence</a>
- of captured variables. If a capture starts with the ampersand sign <code class="computeroutput"><span class="special">&amp;</span></code>, a reference to the captured variable
- will be available inside the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit">ScopeExit</a> body;
- otherwise, a copy of the variable will be made after the point <code class="computeroutput"><span class="special">(</span><span class="number">1</span><span class="special">)</span></code>
- and only the copy will be available inside the body.
- </p>
+ The block below point <code class="literal">(1)</code> is a <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ declaration. Unlike point <code class="literal">(1)</code>, an execution of the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> body will be delayed until the
+ end of the current scope. In this case it will be executed either after point
+ <code class="literal">(4)</code> or on any exception. (On various versions of the GCC
+ compiler, it is necessary to use <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
+ instead of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ within templates, see later in this section for details.)
+ </p>
<p>
- In the example above, variables <code class="computeroutput"><span class="identifier">commit</span></code>
- and <code class="computeroutput"><span class="identifier">m_persons</span></code> are passed by
- reference because the final value of the <code class="computeroutput"><span class="identifier">commit</span></code>
- variable should be used to determine whether to execute rollback action or
- not and the action should modify the <code class="computeroutput"><span class="identifier">m_persons</span></code>
- object, not its copy. This is a most common case but passing a variable by
- value is sometimes useful as well.
- </p>
+ The <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> declaration starts
+ with the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> macro
+ invocation which accepts a comma-separated list of captured variables (a
+ <a href="http://www.boost.org/libs/preprocessor" target="_top">Boost.Preprocessor</a>
+ sequence is also accepted for compilers that do not support variadic macros
+ and for backward compatibility with older versions of this library, see the
+ <a class="link" href="no_variadic_macros.html" title="Annex: No Variadic Macros">No Variadic Macros</a> section).
+ If a capture starts with the ampersand sign <code class="computeroutput"><span class="special">&amp;</span></code>,
+ a reference to the captured variable will be available inside the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ body; otherwise, a copy of the variable will be made after the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ declaration at point <code class="literal">(1)</code> and only the copy will be available
+ inside the body (in this case, the captured variable's type must be <a href="http://www.boost.org/doc/libs/release/doc/html/CopyConstructible.html" target="_top"><code class="computeroutput"><span class="identifier">CopyConstructible</span></code></a>).
+ </p>
<p>
- Consider a more complex case where <code class="computeroutput"><span class="identifier">World</span><span class="special">::</span><span class="identifier">addPerson</span></code>
- can save intermediate states at some points and roll back to the last saved
- state. You can use <code class="computeroutput"><span class="identifier">Person</span><span class="special">::</span><span class="identifier">m_evolution</span></code> to store a version of changes
- and increment it to cancel all rollback actions associated with those changes.
- </p>
+ In the example above, the variables <code class="computeroutput"><span class="identifier">commit</span></code>
+ and <code class="computeroutput"><span class="identifier">persons_</span></code> are captured
+ by reference because the final value of the <code class="computeroutput"><span class="identifier">commit</span></code>
+ variable should be used to determine whether to execute rollback actions
+ or not, and the action should modify the <code class="computeroutput"><span class="identifier">persons_</span></code>
+ object, not its copy. This is the most common case but passing a variable
+ by value is sometimes useful as well.
+ </p>
<p>
- If you pass a current value of <code class="computeroutput"><span class="identifier">m_evolution</span></code>
- stored in the <code class="computeroutput"><span class="identifier">checkpoint</span></code> variable
- by value, it will remain unchanged until the end of aa scope and you can compare
- it with the final value of the <code class="computeroutput"><span class="identifier">m_evolution</span></code>.
- If the latter wasn't incremented since you saved it, the rollback action inside
- the block should be executed:
- </p>
-<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">World</span><span class="special">::</span><span class="identifier">addPerson</span><span class="special">(</span><span class="identifier">Person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">aPerson</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">aPerson</span><span class="special">);</span>
+ Finally, the end of the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ body must be marked by the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>
+ macro which must follow the closing curly bracket <code class="computeroutput"><span class="special">}</span></code>
+ of the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> body.
+ </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>
+ In order to comply with the <a href="http://www.stlport.org/doc/exception_safety.html" target="_top">STL
+ exception safety requirements</a>, the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ body must never throw (because the library implementation executes the
+ body within a destructor call). This is true for all <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ macros (including <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
+ and <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ seen below) on both C++03 and C++11.
+ </p></td></tr>
+</table></div>
+<p>
+ Consider a more complex example where <code class="computeroutput"><span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span></code>
+ can save intermediate states at some point and roll back to the last saved
+ state. We use <code class="computeroutput"><span class="identifier">person</span><span class="special">::</span><span class="identifier">evolution_</span></code> to store a version of the changes
+ and increment it to cancel all rollback actions associated with those changes.
+ If we pass a current value of <code class="computeroutput"><span class="identifier">evolution_</span></code>
+ stored in the <code class="computeroutput"><span class="identifier">checkpoint</span></code>
+ variable by value, it remains unchanged within the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ body so we can compare it with the final value of <code class="computeroutput"><span class="identifier">evolution_</span></code>.
+ If the latter was not incremented since we saved it, the rollback action
+ inside the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> body should
+ be executed. For example (see also <a href="../../../test/world_checkpoint.cpp" target="_top"><code class="literal">world_checkpoint.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
- <span class="comment">// This block must be no-throw
-</span> <span class="identifier">Person</span><span class="special">&amp;</span> <span class="identifier">person</span> <span class="special">=</span> <span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
- <span class="identifier">Person</span><span class="special">::</span><span class="identifier">evolution_t</span> <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="identifier">person</span><span class="special">.</span><span class="identifier">m_evolution</span><span class="special">;</span>
+ <span class="comment">// This block must be no-throw.</span>
+ <span class="identifier">person</span><span class="special">&amp;</span> <span class="identifier">p</span> <span class="special">=</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
+ <span class="identifier">person</span><span class="special">::</span><span class="identifier">evolution_t</span> <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">;</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">checkpoint</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">p</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">persons_</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">checkpoint</span> <span class="special">==</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">)</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
- <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">checkpoint</span><span class="special">)(&amp;</span><span class="identifier">person</span><span class="special">)(&amp;</span><span class="identifier">m_persons</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">{</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">checkpoint</span> <span class="special">==</span> <span class="identifier">person</span><span class="special">.</span><span class="identifier">m_evolution</span><span class="special">)</span>
- <span class="identifier">m_persons</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="comment">// ...</span>
+
+ <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="special">++</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">;</span>
+
+ <span class="comment">// Assign new identifier to the person.</span>
+ <span class="identifier">person</span><span class="special">::</span><span class="identifier">id_t</span> <span class="keyword">const</span> <span class="identifier">prev_id</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span><span class="special">;</span>
+ <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span> <span class="special">=</span> <span class="identifier">next_id_</span><span class="special">++;</span>
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">checkpoint</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">p</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">next_id_</span><span class="special">,</span> <span class="identifier">prev_id</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">checkpoint</span> <span class="special">==</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">next_id_</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span><span class="special">;</span>
+ <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span> <span class="special">=</span> <span class="identifier">prev_id</span><span class="special">;</span>
+ <span class="special">}</span>
<span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
- <span class="comment">// ...
-</span>
- <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="special">++</span><span class="identifier">person</span><span class="special">.</span><span class="identifier">m_evolution</span><span class="special">;</span>
+ <span class="comment">// ...</span>
- <span class="comment">// Assign new id to the person
-</span> <span class="identifier">World</span><span class="special">::</span><span class="identifier">id_t</span> <span class="keyword">const</span> <span class="identifier">prev_id</span> <span class="special">=</span> <span class="identifier">person</span><span class="special">.</span><span class="identifier">m_id</span><span class="special">;</span>
- <span class="identifier">person</span><span class="special">.</span><span class="identifier">m_id</span> <span class="special">=</span> <span class="identifier">m_next_id</span><span class="special">++;</span>
- <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span> <span class="special">(</span><span class="identifier">checkpoint</span><span class="special">)(&amp;</span><span class="identifier">person</span><span class="special">)(&amp;</span><span class="identifier">m_next_id</span><span class="special">)(</span><span class="identifier">prev_id</span><span class="special">)</span> <span class="special">)</span>
- <span class="special">{</span>
- <span class="keyword">if</span><span class="special">(</span><span class="identifier">checkpoint</span> <span class="special">==</span> <span class="identifier">person</span><span class="special">.</span><span class="identifier">m_evolution</span><span class="special">)</span> <span class="special">{</span>
- <span class="identifier">m_next_id</span> <span class="special">=</span> <span class="identifier">person</span><span class="special">.</span><span class="identifier">m_id</span><span class="special">;</span>
- <span class="identifier">person</span><span class="special">.</span><span class="identifier">m_id</span> <span class="special">=</span> <span class="identifier">prev_id</span><span class="special">;</span>
+ <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="special">++</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ When multiple <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> blocks are
+ declared within the same enclosing scope, the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ bodies are executed in the reversed order of their declarations.
+ </p>
+</div>
+<div class="section scope_exit_tutorial_capturing_the_object__this_">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.tutorial.capturing_the_object__this_"></a><a class="link" href="tutorial.html#scope_exit.tutorial.capturing_the_object__this_" title="Capturing The Object this">Capturing
+ The Object <code class="computeroutput"><span class="keyword">this</span></code></a>
+</h3></div></div></div>
+<p>
+ Within a member function, it is also possible to capture the object <code class="computeroutput"><span class="keyword">this</span></code>. However, the special symbol <code class="computeroutput"><span class="identifier">this_</span></code> must be used instead of <code class="computeroutput"><span class="keyword">this</span></code> in the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ declaration and body to capture and access the object. For example (see also
+ <a href="../../../test/world_this.cpp" target="_top"><code class="literal">world_this.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="identifier">this_</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Capture object `this_`.</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+<span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+</pre>
+<p>
+ </p>
+<p>
+ It is not possible to capture the object <code class="computeroutput"><span class="identifier">this_</span></code>
+ by reference because C++ does not allow to take a reference to <code class="computeroutput"><span class="keyword">this</span></code>. If the enclosing member function is
+ constant then the captured object will also be constant, otherwise the captured
+ object will be mutable.
+ </p>
+</div>
+<div class="section scope_exit_tutorial_capturing_no_variable">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.tutorial.capturing_no_variable"></a><a class="link" href="tutorial.html#scope_exit.tutorial.capturing_no_variable" title="Capturing No Variable">Capturing
+ No Variable</a>
+</h3></div></div></div>
+<p>
+ A <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> declaration can also
+ capture no variable. In this case, the list of captured variables is replaced
+ by the <code class="computeroutput"><span class="keyword">void</span></code> keyword (similarly
+ to the C++ syntax that allows to declare a function with no parameter using
+ <code class="literal"><span class="emphasis"><em>result-type function-name</em></span></code><code class="computeroutput"><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code>).
+ <sup>[<a name="scope_exit.tutorial.capturing_no_variable.f0" href="#ftn.scope_exit.tutorial.capturing_no_variable.f0" class="footnote">3</a>]</sup> For example, this can be useful when the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ body only needs to access global variables (see also <a href="../../../test/world_void.cpp" target="_top"><code class="literal">world_void.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">world_t</span> <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">person</span><span class="special">&gt;</span> <span class="identifier">persons</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span><span class="special">;</span>
+<span class="special">}</span> <span class="identifier">world</span><span class="special">;</span> <span class="comment">// Global variable.</span>
+
+<span class="keyword">void</span> <span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">persons</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
+
+ <span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// No captures.</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">world</span><span class="special">.</span><span class="identifier">persons</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
+
+ <span class="comment">// ...</span>
+
+ <span class="identifier">world</span><span class="special">.</span><span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ (Both compilers with and without variadic macros use this same syntax for
+ capturing no variable, see the <a class="link" href="no_variadic_macros.html" title="Annex: No Variadic Macros">No
+ Variadic Macros</a> section for more information.)
+ </p>
+</div>
+<div class="section scope_exit_tutorial_capturing_all_variables__c__11_only_">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.tutorial.capturing_all_variables__c__11_only_"></a><a class="link" href="tutorial.html#scope_exit.tutorial.capturing_all_variables__c__11_only_" title="Capturing All Variables (C++11 Only)">Capturing
+ All Variables (C++11 Only)</a>
+</h3></div></div></div>
+<p>
+ On C++11 compliers, it is also possible to capture all the variables in scope
+ without naming them one-by-one using the special macro <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ instead of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>.
+ <sup>[<a name="scope_exit.tutorial.capturing_all_variables__c__11_only_.f0" href="#ftn.scope_exit.tutorial.capturing_all_variables__c__11_only_.f0" class="footnote">4</a>]</sup>
+ </p>
+<p>
+ Following the same syntax adopted by C++11 lambda functions, the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> macro accepts
+ a comma-separated list of captures which must start with either <code class="computeroutput"><span class="special">&amp;</span></code> or <code class="computeroutput"><span class="special">=</span></code>
+ to capture all variables in scope respectively by reference or by value (note
+ that no variable name is specified by these leading captures). Additional
+ captures of specific variables can follow the leading <code class="computeroutput"><span class="special">&amp;</span></code>
+ or <code class="computeroutput"><span class="special">=</span></code> and they will override
+ the default reference or value captures. For example (see also <a href="../../../test/world_checkpoint_all.cpp" target="_top"><code class="literal">world_checkpoint_all.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">world</span><span class="special">::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
+
+ <span class="comment">// This block must be no-throw.</span>
+ <span class="identifier">person</span><span class="special">&amp;</span> <span class="identifier">p</span> <span class="special">=</span> <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">back</span><span class="special">();</span>
+ <span class="identifier">person</span><span class="special">::</span><span class="identifier">evolution_t</span> <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">;</span>
+ <span class="comment">// Capture all by reference `&amp;`, but `checkpoint` and `this` (C++11 only).</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_ALL</span><span class="special">(&amp;,</span> <span class="identifier">checkpoint</span><span class="special">,</span> <span class="keyword">this</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Use `this` (not `this_`).</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">checkpoint</span> <span class="special">==</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">)</span> <span class="keyword">this</span><span class="special">-&gt;</span><span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
+ <span class="special">};</span> <span class="comment">// Use `;` (not `SCOPE_EXIT_END`).</span>
+
+ <span class="comment">// ...</span>
+
+ <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="special">++</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">;</span>
+
+ <span class="comment">// Assign new identifier to the person.</span>
+ <span class="identifier">person</span><span class="special">::</span><span class="identifier">id_t</span> <span class="keyword">const</span> <span class="identifier">prev_id</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span><span class="special">;</span>
+ <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span> <span class="special">=</span> <span class="identifier">next_id_</span><span class="special">++;</span>
+ <span class="comment">// Capture all by value `=`, but `p` (C++11 only).</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_ALL</span><span class="special">(=,</span> <span class="special">&amp;</span><span class="identifier">p</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">if</span><span class="special">(</span><span class="identifier">checkpoint</span> <span class="special">==</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">this</span><span class="special">-&gt;</span><span class="identifier">next_id_</span> <span class="special">=</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span><span class="special">;</span>
+ <span class="identifier">p</span><span class="special">.</span><span class="identifier">id</span> <span class="special">=</span> <span class="identifier">prev_id</span><span class="special">;</span>
<span class="special">}</span>
+ <span class="special">};</span>
+
+ <span class="comment">// ...</span>
+
+ <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="special">++</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">evolution</span><span class="special">;</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The first <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a> declaration captures
+ all variables in scope by reference but the variable <code class="computeroutput"><span class="identifier">checkpoint</span></code>
+ and the object <code class="computeroutput"><span class="keyword">this</span></code> which are
+ explicitly captured by value (in particular, <code class="computeroutput"><span class="identifier">p</span></code>
+ and <code class="computeroutput"><span class="identifier">persons_</span></code> are implicitly
+ captured by reference here). The second <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ declaration instead captures all variables in scope by value but <code class="computeroutput"><span class="identifier">p</span></code> which is explicitly captured by reference
+ (in particular, <code class="computeroutput"><span class="identifier">checkpoint</span></code>,
+ <code class="computeroutput"><span class="identifier">prev_id</span></code>, and <code class="computeroutput"><span class="keyword">this</span></code> are implicitly captured by value here).
+ </p>
+<p>
+ Note that the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ macro follows the C++11 lambda function syntax which is unfortunately different
+ from the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> macro
+ syntax. In particular:
+ </p>
+<div class="orderedlist"><ol class="orderedlist" type="1">
+<li class="listitem">
+ The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ macro cannot capture data members without capturing the object <code class="computeroutput"><span class="keyword">this</span></code> while that is not the case for <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>. <sup>[<a name="scope_exit.tutorial.capturing_all_variables__c__11_only_.f1" href="#ftn.scope_exit.tutorial.capturing_all_variables__c__11_only_.f1" class="footnote">5</a>]</sup>
+ </li>
+<li class="listitem">
+ The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ macro captures the object in scope using <code class="computeroutput"><span class="keyword">this</span></code>
+ instead of <code class="computeroutput"><span class="identifier">this_</span></code>. <sup>[<a name="scope_exit.tutorial.capturing_all_variables__c__11_only_.f2" href="#ftn.scope_exit.tutorial.capturing_all_variables__c__11_only_.f2" class="footnote">6</a>]</sup>
+ </li>
+<li class="listitem">
+ The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ body is terminated by a semicolon <code class="computeroutput"><span class="special">;</span></code>
+ instead than by the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>
+ macro.
+ </li>
+</ol></div>
+<p>
+ If programmers define the configuration macro <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS.html" title="Macro BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS">BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS</a></code>
+ then the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> macro
+ implementation will use C++11 lamda functions and the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ macro will follow the same syntax of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ macro, which is the C++11 lambda function syntax. However, <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ will no longer be backward compatible and older code using <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ might no longer compile (if data members were explicitly captured).
+ </p>
+</div>
+<div class="section scope_exit_tutorial_template_workaround__gcc_">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.tutorial.template_workaround__gcc_"></a><a class="link" href="tutorial.html#scope_exit.tutorial.template_workaround__gcc_" title="Template Workaround (GCC)">Template
+ Workaround (GCC)</a>
+</h3></div></div></div>
+<p>
+ Various versions of the GCC compiler do not compile <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ inside templates (see the <a href="../reference.html" target="_top">Reference</a> section
+ for more information). As a workaround, <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
+ should be used instead of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ in these cases. <sup>[<a name="scope_exit.tutorial.template_workaround__gcc_.f0" href="#ftn.scope_exit.tutorial.template_workaround__gcc_.f0" class="footnote">7</a>]</sup> The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
+ macro has the exact same syntax of <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>.
+ For example (see also <a href="../../../test/world_tpl.cpp" target="_top"><code class="literal">world_tpl.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Person</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">world</span><span class="special">&lt;</span><span class="identifier">Person</span><span class="special">&gt;::</span><span class="identifier">add_person</span><span class="special">(</span><span class="identifier">Person</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a_person</span><span class="special">)</span> <span class="special">{</span>
+ <span class="keyword">bool</span> <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
+ <span class="identifier">persons_</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">a_person</span><span class="special">);</span>
+
+ <span class="identifier">BOOST_SCOPE_EXIT_TPL</span><span class="special">(&amp;</span><span class="identifier">commit</span><span class="special">,</span> <span class="identifier">this_</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// Use `_TPL` postfix.</span>
+ <span class="keyword">if</span><span class="special">(!</span><span class="identifier">commit</span><span class="special">)</span> <span class="identifier">this_</span><span class="special">-&gt;</span><span class="identifier">persons_</span><span class="special">.</span><span class="identifier">pop_back</span><span class="special">();</span>
<span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END</span>
- <span class="comment">// ...
-</span>
- <span class="identifier">checkpoint</span> <span class="special">=</span> <span class="special">++</span><span class="identifier">person</span><span class="special">.</span><span class="identifier">m_evolution</span><span class="special">;</span>
+ <span class="comment">// ...</span>
+
+ <span class="identifier">commit</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
- Full code listing can be found in <a href="../../../example/world.cpp" target="_top">world.cpp</a>.
- </p>
+ </p>
+<p>
+ It is recommended to always use <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>
+ within templates so to maximize portability among different compilers.
+ </p>
+</div>
+<div class="section scope_exit_tutorial_same_line_expansions">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="scope_exit.tutorial.same_line_expansions"></a><a class="link" href="tutorial.html#scope_exit.tutorial.same_line_expansions" title="Same Line Expansions">Same Line Expansions</a>
+</h3></div></div></div>
+<p>
+ In general, it is not possible to expand the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>,
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code>,
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code>, and
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> macros
+ multiple times on the same line. <sup>[<a name="scope_exit.tutorial.same_line_expansions.f0" href="#ftn.scope_exit.tutorial.same_line_expansions.f0" class="footnote">8</a>]</sup>
+ </p>
+<p>
+ Therefore, this library provides additional macros <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code>,
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a></code>,
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">BOOST_SCOPE_EXIT_END_ID</a></code>,
+ and <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a></code>
+ which can be expanded multiple times on the same line as long as programmers
+ specify a unique identifiers as the macros' first parameters. The unique
+ identifier can be any token (not just numeric) that can be concatenated by
+ the C++ preprocessor (e.g., <code class="computeroutput"><span class="identifier">scope_exit_number_1_at_line_123</span></code>).
+ <sup>[<a name="scope_exit.tutorial.same_line_expansions.f1" href="#ftn.scope_exit.tutorial.same_line_expansions.f1" class="footnote">9</a>]</sup>
+ </p>
+<p>
+ The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code>,
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a></code>,
+ and <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a></code>
+ macros accept a capture list using the exact same syntax as <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ and <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ respectively. For example (see also <a href="../../../test/same_line.cpp" target="_top"><code class="literal">same_line.cpp</code></a>):
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">SCOPE_EXIT_INC_DEC</span><span class="special">(</span><span class="identifier">variable</span><span class="special">,</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">\</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">inc</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">),</span> <span class="comment">/* unique ID */</span> <span class="special">\</span>
+ <span class="special">&amp;</span><span class="identifier">variable</span><span class="special">,</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">{</span> <span class="special">\</span>
+ <span class="identifier">variable</span> <span class="special">+=</span> <span class="identifier">offset</span><span class="special">;</span> <span class="special">\</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">inc</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">))</span> <span class="special">\</span>
+ <span class="special">\</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">dec</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">),</span> <span class="special">\</span>
+ <span class="special">&amp;</span><span class="identifier">variable</span><span class="special">,</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">{</span> <span class="special">\</span>
+ <span class="identifier">variable</span> <span class="special">-=</span> <span class="identifier">offset</span><span class="special">;</span> <span class="special">\</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">dec</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">))</span>
+
+<span class="preprocessor">#define</span> <span class="identifier">SCOPE_EXIT_INC_DEC_TPL</span><span class="special">(</span><span class="identifier">variable</span><span class="special">,</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">\</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_TPL_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">inc</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">),</span> <span class="special">\</span>
+ <span class="special">&amp;</span><span class="identifier">variable</span><span class="special">,</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">{</span> <span class="special">\</span>
+ <span class="identifier">variable</span> <span class="special">+=</span> <span class="identifier">offset</span><span class="special">;</span> <span class="special">\</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">inc</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">))</span> <span class="special">\</span>
+ <span class="special">\</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_TPL_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">dec</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">),</span> <span class="special">\</span>
+ <span class="special">&amp;</span><span class="identifier">variable</span><span class="special">,</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">{</span> <span class="special">\</span>
+ <span class="identifier">variable</span> <span class="special">-=</span> <span class="identifier">offset</span><span class="special">;</span> <span class="special">\</span>
+ <span class="special">}</span> <span class="identifier">BOOST_SCOPE_EXIT_END_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">dec</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">))</span>
+
+<span class="preprocessor">#define</span> <span class="identifier">SCOPE_EXIT_ALL_INC_DEC</span><span class="special">(</span><span class="identifier">variable</span><span class="special">,</span> <span class="identifier">offset</span><span class="special">)</span> <span class="special">\</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_ALL_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">inc</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">),</span> <span class="special">\</span>
+ <span class="special">=,</span> <span class="special">&amp;</span><span class="identifier">variable</span><span class="special">)</span> <span class="special">{</span> <span class="special">\</span>
+ <span class="identifier">variable</span> <span class="special">+=</span> <span class="identifier">offset</span><span class="special">;</span> <span class="special">\</span>
+ <span class="special">};</span> <span class="special">\</span>
+ <span class="identifier">BOOST_SCOPE_EXIT_ALL_ID</span><span class="special">(</span><span class="identifier">BOOST_PP_CAT</span><span class="special">(</span><span class="identifier">dec</span><span class="special">,</span> <span class="identifier">__LINE__</span><span class="special">),</span> <span class="special">\</span>
+ <span class="special">=,</span> <span class="special">&amp;</span><span class="identifier">variable</span><span class="special">)</span> <span class="special">{</span> <span class="special">\</span>
+ <span class="identifier">variable</span> <span class="special">-=</span> <span class="identifier">offset</span><span class="special">;</span> <span class="special">\</span>
+ <span class="special">};</span>
+
+<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T</span><span class="special">&amp;</span> <span class="identifier">delta</span><span class="special">)</span> <span class="special">{</span>
+ <span class="identifier">SCOPE_EXIT_INC_DEC_TPL</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">delta</span><span class="special">)</span> <span class="comment">// Multiple scope exits on same line.</span>
+ <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</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="keyword">void</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="number">0</span><span class="special">,</span> <span class="identifier">delta</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
+
+ <span class="special">{</span>
+ <span class="identifier">SCOPE_EXIT_INC_DEC</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">delta</span><span class="special">)</span> <span class="comment">// Multiple scope exits on same line.</span>
+ <span class="special">}</span>
+ <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
+
+ <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">delta</span><span class="special">);</span>
+
+<span class="preprocessor">#ifndef</span> <span class="identifier">BOOST_NO_LAMBDAS</span>
+ <span class="special">{</span>
+ <span class="identifier">SCOPE_EXIT_ALL_INC_DEC</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">delta</span><span class="special">)</span> <span class="comment">// Multiple scope exits on same line.</span>
+ <span class="special">}</span>
+ <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
+<span class="preprocessor">#endif</span> <span class="comment">// LAMBDAS</span>
+
+ <span class="keyword">return</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">report_errors</span><span class="special">();</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ As shown by the example above, the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ID.html" title="Macro BOOST_SCOPE_EXIT_ID">BOOST_SCOPE_EXIT_ID</a></code>,
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ID_TPL.html" title="Macro BOOST_SCOPE_EXIT_ID_TPL">BOOST_SCOPE_EXIT_ID_TPL</a></code>,
+ <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_END_ID.html" title="Macro BOOST_SCOPE_EXIT_END_ID">BOOST_SCOPE_EXIT_END_ID</a></code>,
+ and <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL_ID.html" title="Macro BOOST_SCOPE_EXIT_ALL_ID">BOOST_SCOPE_EXIT_ALL_ID</a></code>
+ macros are especially useful when it is necessary to invoke them multiple
+ times within user-defined macros (because the C++ preprocessor expands all
+ nested macros on the same line).
+ </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.tutorial.capturing_no_variable.f0" href="#scope_exit.tutorial.capturing_no_variable.f0" class="para">3</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> Unfortunately, it is not possible
+ to simply invoke the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
+ macro with no parameters as in <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">()</span></code> because the C++ preprocessor cannot detect
+ emptiness of a macro parameter when the parameter can start with a non-alphanumeric
+ symbol (which is the case when capturing a variable by reference <code class="computeroutput"><span class="special">&amp;</span><span class="identifier">variable</span></code>).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.tutorial.capturing_all_variables__c__11_only_.f0" href="#scope_exit.tutorial.capturing_all_variables__c__11_only_.f0" class="para">4</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> The <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ macro is only defined on C++11 compilers for which the <a href="http://www.boost.org/libs/config" target="_top">Boost.Config</a>
+ macro <code class="computeroutput"><span class="identifier">BOOST_NO_LAMBDAS</span></code>
+ is not defined. Using <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ on C++03 compilers for which <code class="computeroutput"><span class="identifier">BOOST_NO_LAMBDAS</span></code>
+ is defined will generate (possibly cryptic) compiler errors. Note that
+ a new macro <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ needed to be introduced instead of reusing <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ because <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(&amp;)</span></code> and <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(=)</span></code> cannot be distinguished from <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span></code> or
+ <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT</span><span class="special">(</span><span class="identifier">this_</span><span class="special">)</span></code>
+ using the C++ preprocessor given that the symbols <code class="computeroutput"><span class="special">&amp;</span></code>
+ and <code class="computeroutput"><span class="special">=</span></code> are neither prefxied
+ nor postfixed by alphanumeric tokens (this is not an issue for <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> which always
+ has the non-alphanumeric <code class="computeroutput"><span class="special">&amp;</span></code>
+ or <code class="computeroutput"><span class="special">=</span></code> as the first capture
+ so the first capture tokens are simply never compared with neither <code class="computeroutput"><span class="keyword">void</span></code> nor <code class="computeroutput"><span class="identifier">this_</span></code>
+ for this macro).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.tutorial.capturing_all_variables__c__11_only_.f1" href="#scope_exit.tutorial.capturing_all_variables__c__11_only_.f1" class="para">5</a>] </sup>
+ At present, there seems to be some discussion to allow C++11 lambda
+ functions to capture data members without capturing the object <code class="computeroutput"><span class="keyword">this</span></code>. If the C++11 standard were changed
+ to allow this, the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ macro syntax could be extended to be a superset of the <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code>
+ macro while keeping full backward compatibility.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.tutorial.capturing_all_variables__c__11_only_.f2" href="#scope_exit.tutorial.capturing_all_variables__c__11_only_.f2" class="para">6</a>] </sup>
+ On compilers that support the use of the <code class="computeroutput"><span class="keyword">typename</span></code>
+ outside templates as allowed by the C++11 standard, <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ can use both <code class="computeroutput"><span class="keyword">this</span></code> and
+ <code class="computeroutput"><span class="identifier">this_</span></code> to capture the
+ object in scope (notably, this is not the case for the MSVC 10.0 compiler).
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.tutorial.template_workaround__gcc_.f0" href="#scope_exit.tutorial.template_workaround__gcc_.f0" class="para">7</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> GCC versions compliant with
+ C++11 do not present this issue and given that <code class="computeroutput"><a class="link" href="../BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code>
+ is only available on C++11 compilers, there is no need for a <code class="computeroutput"><span class="identifier">BOOST_SCOPE_EXIT_ALL_TPL</span></code> macro.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.tutorial.same_line_expansions.f0" href="#scope_exit.tutorial.same_line_expansions.f0" class="para">8</a>] </sup>
+ <span class="bold"><strong>Rationale.</strong></span> The library macros internally
+ use <code class="computeroutput"><span class="identifier">__LINE__</span></code> to generate
+ unique identifiers. Therefore, if the same macro is expanded more than
+ on time on the same line, the generated identifiers will no longer be unique
+ and the code will not compile. (This restriction does not apply to MSVC
+ and other compilers that provide the non-standard <code class="computeroutput"><span class="identifier">__COUNTER__</span></code>
+ macro.)
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.scope_exit.tutorial.same_line_expansions.f1" href="#scope_exit.tutorial.same_line_expansions.f1" class="para">9</a>] </sup>
+ Because there are restrictions on the set of tokens that the C++ preprocessor
+ can concatenate and because not all compilers correctly implement these
+ restrictions, it is in general recommended to specify unique identifiers
+ as a combination of alphanumeric tokens.
+ </p></div>
+</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
-<td align="right"><div class="copyright-footer">Copyright &#169; 2006 -2009 Alexander Nasonov<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
- http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
+<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2012 Alexander Nasonov, Lorenzo Caminiti<p>
+ Distributed under the Boost Software License, Version 1.0 (see accompanying
+ file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
-<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alternatives.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+<a accesskey="p" href="getting_started.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="alternatives.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
diff --git a/libs/scope_exit/doc/scope_exit.qbk b/libs/scope_exit/doc/scope_exit.qbk
index 636ef75ed3..e242cdfa22 100644
--- a/libs/scope_exit/doc/scope_exit.qbk
+++ b/libs/scope_exit/doc/scope_exit.qbk
@@ -1,480 +1,500 @@
+
+[/ Copyright (C) 2006-2009, 2012 Alexander Nasonov ]
+[/ Copyright (C) 2012 Lorenzo Caminiti ]
+[/ Distributed under the Boost Software License, Version 1.0 ]
+[/ (see accompanying file LICENSE_1_0.txt or a copy at ]
+[/ http://www.boost.org/LICENSE_1_0.txt) ]
+[/ Home at http://www.boost.org/libs/scope_exit ]
+
[library Boost.ScopeExit
- [copyright 2006-2009 Alexander Nasonov]
+ [quickbook 1.5]
+ [version 1.1.0]
+ [copyright 2006-2012 Alexander Nasonov, Lorenzo Caminiti]
[purpose execute arbitrary code at scope exit]
[license
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- <ulink url="http://www.boost.org/LICENSE_1_0.txt">
- http://www.boost.org/LICENSE_1_0.txt
- </ulink>)
+ Distributed under the Boost Software License, Version 1.0
+ (see accompanying file LICENSE_1_0.txt or a copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+ ]
+ [authors
+ [Nasonov, Alexander]
+ [Caminiti <email>lorcaminiti@gmail.com</email>, Lorenzo]
]
- [authors [Nasonov, Alexander]]
[category utility]
[id scope_exit]
[dirname scope_exit]
]
-[/ Images ]
-
-[def _note_ [$images/note.png]]
-
-[/ Links ]
-
-[def _scope_exit_ [link scope_exit ScopeExit]]
-[def _Tutorial_ [link scope_exit.tutorial Tutorial]]
-[def _Reference_ [link scope_exit.ref Reference]]
-[def _lambda_ [@../../../../libs/lambda/index.html Boost.Lambda]]
-[def _typeof_ [@../../../../libs/typeof/index.html Boost.Typeof]]
-[def _typeof_emulation_ [@../../../../libs/typeof/index.html typeof emulation]]
-[def _typeof_REGISTER_TYPE_ [@../../../../doc/html/typeof/refe.html#typeof.regtype BOOST_TYPEOF_REGISTER_TYPE]]
-[def _typeof_REGISTER_TEMPLATE_ [@../../../../doc/html/typeof/refe.html#typeof.regtemp BOOST_TYPEOF_REGISTER_TEMPLATE]]
-[def _pp_ [@../../../../libs/preprocessor/index.html Boost.Preprocessor]]
-[def _pp_seq_ [@../../../../libs/preprocessor/index.html Boost.Preprocessor sequence]]
-[def _ptr_container_ [@../../../../libs/ptr_container/doc/ptr_container.html Boost Pointer Container Library]]
-[def _multi_index_ [@../../../../libs/multi_index/doc/index.html Boost Multi-Index Containers Library]]
-[def _scope_guard_ [@http://www.ddj.com/dept/cpp/184403758 ScopeGuard]]
-[def _D_ [@http://www.digitalmars.com/d/index.html D]]
-[def _D_scope_exit_ [@http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement scope(exit)]]
-[def _RAII_ [@http://www.research.att.com/~bs/glossary.html#Gresource-acquisition-is-initialization RAII]]
-[def _strong_guarantee_ [@http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee strong guarantee]]
-
-[section:intro Introduction]
-
-Nowadays, every C++ developer is familiar with _RAII_ technique.
-It binds resource acquisition and release to initialization and
-destruction of a variable that holds the resource. But there are
-times when writing a special class for such variable is not worth
-the effort.
-
-This is when _scope_exit_ macro comes into play. You put resource
-acquisition directly in your code and next to it you write a code
-that releases the resource.
-
-Read _Tutorial_ to find out how to write programs with
-_scope_exit_ or jump straight to the _Reference_ section.
+[def __Introduction__ [link scope_exit.introduction Introduction]]
+[def __Getting_Started__ [link scope_exit.getting_started Getting Started]]
+[def __Tutorial__ [link scope_exit.tutorial Tutorial]]
+[def __No_Variadic_Macros__ [link scope_exit.no_variadic_macros No Variadic Macros]]
+[def __Reference__ [@reference.html Reference]]
+[def __Boost_ScopeExit__ [link scope_exit Boost.ScopeExit]]
+[def __Boost_Lambda__ [@http://www.boost.org/libs/lambda Boost.Lambda]]
+[def __Boost_Phoenix__ [@http://www.boost.org/libs/phoenix Boost.Phoenix]]
+[def __Boost_Typeof__ [@http://www.boost.org/libs/typeof Boost.Typeof]]
+[def __typeof_emulation__ [@http://www.boost.org/libs/typeof type-of emulation]]
+[def __Boost_Preprocessor__ [@http://www.boost.org/libs/preprocessor Boost.Preprocessor]]
+[def __Boost_Config__ [@http://www.boost.org/libs/config Boost.Config]]
+[def __Boost_PointerContainer__ [@http://www.boost.org/libs/ptr_container Boost.PointerContainer]]
+[def __Boost_Multi_Index__ [@http://www.boost.org/libs/multi_index Boost.Multi-Index]]
+[def __ScopeGuard__ [@http://www.ddj.com/dept/cpp/184403758 ScopeGuard]]
+[def __D__ [@http://www.digitalmars.com/d/index.html D]]
+[def __D_scope_exit__ [@http://www.digitalmars.com/d/2.0/statement.html#ScopeGuardStatement scope(exit)]]
+[def __RAII__ [@http://www.research.att.com/~bs/glossary.html#Gresource-acquisition-is-initialization RAII]]
+[def __strong_guarantee__ [@http://www.research.att.com/~bs/glossary.html#Gstrong-guarantee strong guarantee]]
+
+[import ../test/world.cpp]
+[import ../test/world_seq.cpp]
+[import ../test/world_checkpoint.cpp]
+[import ../test/world_this.cpp]
+[import ../test/world_void.cpp]
+[import ../test/world_checkpoint_all.cpp]
+[import ../test/world_tpl.cpp]
+[import ../test/same_line.cpp]
+[import ../example/try_catch.cpp]
+[import ../example/scope_guard.cpp]
+[import ../example/world_cxx11_lambda.cpp]
+
+This library allows to execute arbitrary code when the enclosing scope exits.
+
+[section Introduction]
+
+Nowadays, every C++ developer is familiar with the Resource Acquisition Is Initialization (__RAII__) technique.
+It binds resource acquisition and release to initialization and destruction of a variable that holds the resource.
+There are times when writing a special class for such a variable is not worth the effort.
+This is when __Boost_ScopeExit__ comes into play.
+
+Programmers can put resource acquisition directly in their code and next to it, they can write code that releases the resource using this library.
+For example (see also [@../../test/world.cpp =world.cpp=]):
+[footnote
+Older versions of this library used a __Boost_Preprocessor__ sequence to specify the list of captured variables.
+While maintaining full backward compatibility, it is now possible to specify the captured variables also using a comma-separated list (which is the preferred syntax).
+See the __No_Variadic_Macros__ section for more information.
+]
+
+[world]
[endsect]
-[section:tutorial Tutorial]
+[section Getting Started]
-Imagine that you want to make many modifications to data members
-of the `World` class in the `World::addPerson` function.
-You start with adding a new `Person` object to a vector of persons:
+This section explains how to setup a system to use this library.
- void World::addPerson(Person const& person) {
- bool commit = false;
- m_persons.push_back(person); // (1) direct action
+[section This Documentation]
-Some operation down the road may throw an exception and all changes
-to involved objects should be rolled back. This all-or-nothing semantic
-is also known as _strong_guarantee_.
+Programmers should have enough knowledge to use this library after reading the __Introduction__, __Getting_Started__, and __Tutorial__ sections.
+The __Reference__ section can be consulted at a later point for quick reference.
+All the other sections of this documentation can be considered optional.
-In particular, last added person must be deleted from `m_persons` when
-the function throws. All you need is to define a delayed action (release
-of a resource) right after the direct action (resource acquisition):
+Some footnotes are marked by the word "*Rationale*".
+They explain reasons behind decisions made during the design and implementation of this library.
- void World::addPerson(Person const& aPerson) {
- bool commit = false;
- m_persons.push_back(aPerson); // (1) direct action
- BOOST_SCOPE_EXIT( (&commit)(&m_persons) )
- {
- if(!commit)
- m_persons.pop_back(); // (2) rollback action
- } BOOST_SCOPE_EXIT_END
-
- // ... // (3) other operations
-
- commit = true; // (4) turn all rollback actions into no-op
- }
+In most of the examples presented in this documentation, the Boost.Detail/LightweightTest (=boost/detail/lightweight_test.hpp=) macro `BOOST_TEST` is used to check correctness conditions.
+The `BOOST_TEST` macro is conceptually similar to `assert` but a failure of the checked condition does not abort the program, instead it makes `boost::report_errors` return a non-zero program exit code.
+[footnote
+*Rationale.*
+Using Boost.Detail/LightweightTest allows to add the examples to the library regression tests so to make sure that they always compile and run correctly.
+]
-The block below point `(1)` is a _scope_exit_ declaration.
-Unlike point `(1)`, an execution of the _scope_exit_ body will be
-delayed until the end of the current scope. In this case it will be
-executed either after point `(4)` or on any exception.
-
-The _scope_exit_ declaration starts with `BOOST_SCOPE_EXIT` macro
-invocation which accepts _pp_seq_ of captured variables. If a capture
-starts with the ampersand sign `&`, a reference to the captured variable
-will be available inside the _scope_exit_ body; otherwise, a copy of the
-variable will be made after the point `(1)` and only the copy will be
-available inside the body.
-
-In the example above, variables `commit` and `m_persons` are passed
-by reference because the final value of the `commit` variable should
-be used to determine whether to execute rollback action or not and
-the action should modify the `m_persons` object, not its copy.
-This is a most common case but passing a variable by value is
-sometimes useful as well.
-
-Consider a more complex case where `World::addPerson` can save intermediate
-states at some points and roll back to the last saved state. You can
-use `Person::m_evolution` to store a version of changes and increment it
-to cancel all rollback actions associated with those changes.
-
-If you pass a current value of `m_evolution` stored in the `checkpoint`
-variable by value, it will remain unchanged until the end of aa scope
-and you can compare it with the final value of the `m_evolution`.
-If the latter wasn't incremented since you saved it, the rollback action
-inside the block should be executed:
-
- void World::addPerson(Person const& aPerson) {
- m_persons.push_back(aPerson);
-
- // This block must be no-throw
- Person& person = m_persons.back();
- Person::evolution_t checkpoint = person.m_evolution;
-
- BOOST_SCOPE_EXIT( (checkpoint)(&person)(&m_persons) )
- {
- if(checkpoint == person.m_evolution)
- m_persons.pop_back();
- } BOOST_SCOPE_EXIT_END
-
- // ...
-
- checkpoint = ++person.m_evolution;
-
- // Assign new id to the person
- World::id_t const prev_id = person.m_id;
- person.m_id = m_next_id++;
- BOOST_SCOPE_EXIT( (checkpoint)(&person)(&m_next_id)(prev_id) )
- {
- if(checkpoint == person.m_evolution) {
- m_next_id = person.m_id;
- person.m_id = prev_id;
- }
- } BOOST_SCOPE_EXIT_END
-
- // ...
-
- checkpoint = ++person.m_evolution;
- }
+[endsect]
+
+[section Compilers and Platforms]
+
+The authors originally developed and tested the library on GNU Compiler Collection (GCC) C++ 3.3, 3.4, 4.1, 4.2, 4.5.3 (with and without C++11 features [^-std=c++0x]), Microsoft Visual C++ (MSVC) 8.0, and Intel 10.1 under Linux, Cygwin, and Windows 7.
+However, this library should be usable on any compiler that supports __Boost_Typeof__ except:
-Full code listing can be found in [@../../example/world.cpp world.cpp].
+* MSVC 7.1 and 8.0 fail to link if a function with __Boost_ScopeExit__ is included by multiple translation units.
+* GCC 3.3 cannot compile __Boost_ScopeExit__ inside a template (see [@http://lists.boost.org/Archives/boost/2007/02/116235.php] for details).
+
+See the library [@http://www.boost.org/development/tests/release/developer/scope_exit.html regression test results] for detailed information on supported compilers and platforms.
+Check the library regression test [@../../test/Jamfile.v2 =Jamfile.v2=] for any special configuration that might be required for a specific compiler.
[endsect]
-[section:alternatives Alternatives]
+[section Installation]
-[h3 try-catch]
+This library is composed of header files only.
+Therefore there is no pre-compiled object file which needs to be installed.
+Programmers can simply instruct the compiler where to find the library header files (`-I` option on GCC, `/I` option on MSVC, etc) and compile code using the library.
-This is an example of using a badly designed `File` class. An
-instance of `File` doesn't close a file in a destructor, a programmer
-is expected to call the `close` member function explicitly.
+The library implementation uses __Boost_Typeof__ to automatically deduce the types of the __Boost_ScopeExit__ captured variables (see the __Tutorial__ section).
+In order to compile code in __typeof_emulation__ mode, all types should be properly registered using `BOOST_TYPEOF_REGISTER_TYPE` and `BOOST_TYPEOF_REGISTER_TEMPLATE`, or appropriate __Boost_Typeof__ headers should be included (see the source code of most examples presented in this documentation).
- File passwd;
- try {
- passwd.open("/etc/passwd");
- // ...
- passwd.close();
- }
- catch(...) {
- log("could not get user info");
- if(passwd.is_open())
- passwd.close();
- throw;
- }
+[endsect]
-Note the following:
+[endsect]
-* the `passwd` object is defined outside of the `try` block because
-this object is required inside the `catch` block to close the file,
-* the `passwd` object is not fully constructed until after the `open`
-member function returns, and
-* if opening throws, the `passwd.close()` should not be called,
-hence the call to `passwd.is_open()`.
+[section Tutorial]
-_scope_exit_ doesn't have any of these problems:
+This section illustrates how to use this library.
- try {
- File passwd("/etc/passwd");
- BOOST_SCOPE_EXIT( (&passwd) ) {
- passwd.close();
- } BOOST_SCOPE_EXIT_END
- // ...
- }
- catch(...) {
- log("could not get user info");
- throw;
- }
+[section Capturing Variables]
+
+Imagine that we want to make many modifications to data members of some `world` class in its `world::add_person` member function.
+We start with adding a new `person` object to a vector of persons:
+
+ void world::add_person(person const& a_person) {
+ bool commit = false;
+
+ persons_.push_back(a_person); // (1) direct action
+ ...
+
+Some operations down the road may throw an exception and all changes to involved objects should be rolled back.
+This all-or-nothing semantic is also known as __strong_guarantee__.
+
+In particular, the last added person must be deleted from `persons_` if the function throws.
+All we need is to define a delayed action (release of a resource) right after the direct action (resource acquisition).
+For example (see also [@../../test/world.cpp =world.cpp=]):
+
+[world]
+
+The block below point =(1)= is a __Boost_ScopeExit__ declaration.
+Unlike point =(1)=, an execution of the __Boost_ScopeExit__ body will be delayed until the end of the current scope. In this case it will be executed either after point =(4)= or on any exception.
+(On various versions of the GCC compiler, it is necessary to use [macroref BOOST_SCOPE_EXIT_TPL] instead of [macroref BOOST_SCOPE_EXIT] within templates, see later in this section for details.)
+
+The __Boost_ScopeExit__ declaration starts with the [macroref BOOST_SCOPE_EXIT] macro invocation which accepts a comma-separated list of captured variables (a __Boost_Preprocessor__ sequence is also accepted for compilers that do not support variadic macros and for backward compatibility with older versions of this library, see the __No_Variadic_Macros__ section).
+If a capture starts with the ampersand sign `&`, a reference to the captured variable will be available inside the __Boost_ScopeExit__ body; otherwise, a copy of the variable will be made after the __Boost_ScopeExit__ declaration at point =(1)= and only the copy will be available inside the body (in this case, the captured variable's type must be [@http://www.boost.org/doc/libs/release/doc/html/CopyConstructible.html `CopyConstructible`]).
-[h3 RAII]
+In the example above, the variables `commit` and `persons_` are captured by reference because the final value of the `commit` variable should be used to determine whether to execute rollback actions or not, and the action should modify the `persons_` object, not its copy.
+This is the most common case but passing a variable by value is sometimes useful as well.
+
+Finally, the end of the __Boost_ScopeExit__ body must be marked by the [macroref BOOST_SCOPE_EXIT_END] macro which must follow the closing curly bracket `}` of the __Boost_ScopeExit__ body.
+
+[important
+In order to comply with the [@http://www.stlport.org/doc/exception_safety.html STL exception safety requirements], the __Boost_ScopeExit__ body must never throw (because the library implementation executes the body within a destructor call).
+This is true for all __Boost_ScopeExit__ macros (including [macroref BOOST_SCOPE_EXIT_TPL] and [macroref BOOST_SCOPE_EXIT_ALL] seen below) on both C++03 and C++11.
+]
+
+Consider a more complex example where `world::add_person` can save intermediate states at some point and roll back to the last saved state.
+We use `person::evolution_` to store a version of the changes and increment it to cancel all rollback actions associated with those changes.
+If we pass a current value of `evolution_` stored in the `checkpoint` variable by value, it remains unchanged within the __Boost_ScopeExit__ body so we can compare it with the final value of `evolution_`.
+If the latter was not incremented since we saved it, the rollback action inside the __Boost_ScopeExit__ body should be executed.
+For example (see also [@../../test/world_checkpoint.cpp =world_checkpoint.cpp=]):
+
+[world_checkpoint]
+
+When multiple __Boost_ScopeExit__ blocks are declared within the same enclosing scope, the __Boost_ScopeExit__ bodies are executed in the reversed order of their declarations.
+
+[endsect]
+
+[section Capturing The Object `this`]
+
+Within a member function, it is also possible to capture the object `this`.
+However, the special symbol `this_` must be used instead of `this` in the __Boost_ScopeExit__ declaration and body to capture and access the object.
+For example (see also [@../../test/world_this.cpp =world_this.cpp=]):
+
+[world_this]
+
+It is not possible to capture the object `this_` by reference because C++ does not allow to take a reference to `this`.
+If the enclosing member function is constant then the captured object will also be constant, otherwise the captured object will be mutable.
+
+[endsect]
+
+[section Capturing No Variable]
+
+A __Boost_ScopeExit__ declaration can also capture no variable.
+In this case, the list of captured variables is replaced by the `void` keyword (similarly to the C++ syntax that allows to declare a function with no parameter using [^['result-type function-name]]`(void)`).
+[footnote
+*Rationale.*
+Unfortunately, it is not possible to simply invoke the __Boost_ScopeExit__ macro with no parameters as in `BOOST_SCOPE_EXIT()` because the C++ preprocessor cannot detect emptiness of a macro parameter when the parameter can start with a non-alphanumeric symbol (which is the case when capturing a variable by reference `&variable`).
+]
+For example, this can be useful when the __Boost_ScopeExit__ body only needs to access global variables (see also [@../../test/world_void.cpp =world_void.cpp=]):
+
+[world_void]
+
+(Both compilers with and without variadic macros use this same syntax for capturing no variable, see the __No_Variadic_Macros__ section for more information.)
+
+[endsect]
+
+[section Capturing All Variables (C++11 Only)]
+
+On C++11 compliers, it is also possible to capture all the variables in scope without naming them one-by-one using the special macro [macroref BOOST_SCOPE_EXIT_ALL] instead of [macroref BOOST_SCOPE_EXIT].
+[footnote
+*Rationale.*
+The [macroref BOOST_SCOPE_EXIT_ALL] macro is only defined on C++11 compilers for which the __Boost_Config__ macro `BOOST_NO_LAMBDAS` is not defined.
+Using [macroref BOOST_SCOPE_EXIT_ALL] on C++03 compilers for which `BOOST_NO_LAMBDAS` is defined will generate (possibly cryptic) compiler errors.
+Note that a new macro [macroref BOOST_SCOPE_EXIT_ALL] needed to be introduced instead of reusing [macroref BOOST_SCOPE_EXIT] because `BOOST_SCOPE_EXIT(&)` and `BOOST_SCOPE_EXIT(=)` cannot be distinguished from `BOOST_SCOPE_EXIT(void)` or `BOOST_SCOPE_EXIT(this_)` using the C++ preprocessor given that the symbols `&` and `=` are neither prefxied nor postfixed by alphanumeric tokens (this is not an issue for [macroref BOOST_SCOPE_EXIT_ALL] which always has the non-alphanumeric `&` or `=` as the first capture so the first capture tokens are simply never compared with neither `void` nor `this_` for this macro).
+]
-_RAII_ is absolutely perfect for the `File` class introduced above.
-Use of a properly designed `File` class would look like:
+Following the same syntax adopted by C++11 lambda functions, the [macroref BOOST_SCOPE_EXIT_ALL] macro accepts a comma-separated list of captures which must start with either `&` or `=` to capture all variables in scope respectively by reference or by value (note that no variable name is specified by these leading captures).
+Additional captures of specific variables can follow the leading `&` or `=` and they will override the default reference or value captures.
+For example (see also [@../../test/world_checkpoint_all.cpp =world_checkpoint_all.cpp=]):
+
+[world_checkpoint_all]
+
+The first __Boost_ScopeExit__ declaration captures all variables in scope by reference but the variable `checkpoint` and the object `this` which are explicitly captured by value (in particular, `p` and `persons_` are implicitly captured by reference here).
+The second __Boost_ScopeExit__ declaration instead captures all variables in scope by value but `p` which is explicitly captured by reference (in particular, `checkpoint`, `prev_id`, and `this` are implicitly captured by value here).
+
+Note that the [macroref BOOST_SCOPE_EXIT_ALL] macro follows the C++11 lambda function syntax which is unfortunately different from the [macroref BOOST_SCOPE_EXIT] macro syntax.
+In particular:
+
+# The [macroref BOOST_SCOPE_EXIT_ALL] macro cannot capture data members without capturing the object `this` while that is not the case for [macroref BOOST_SCOPE_EXIT].
+[footnote
+At present, there seems to be some discussion to allow C++11 lambda functions to capture data members without capturing the object `this`.
+If the C++11 standard were changed to allow this, the [macroref BOOST_SCOPE_EXIT_ALL] macro syntax could be extended to be a superset of the [macroref BOOST_SCOPE_EXIT] macro while keeping full backward compatibility.
+]
+# The [macroref BOOST_SCOPE_EXIT_ALL] macro captures the object in scope using `this` instead of `this_`.
+[footnote
+On compilers that support the use of the `typename` outside templates as allowed by the C++11 standard, [macroref BOOST_SCOPE_EXIT_ALL] can use both `this` and `this_` to capture the object in scope (notably, this is not the case for the MSVC 10.0 compiler).
+]
+# The [macroref BOOST_SCOPE_EXIT_ALL] body is terminated by a semicolon `;` instead than by the [macroref BOOST_SCOPE_EXIT_END] macro.
+
+If programmers define the configuration macro [macroref BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS] then the [macroref BOOST_SCOPE_EXIT] macro implementation will use C++11 lamda functions and the [macroref BOOST_SCOPE_EXIT] macro will follow the same syntax of [macroref BOOST_SCOPE_EXIT_ALL] macro, which is the C++11 lambda function syntax.
+However, [macroref BOOST_SCOPE_EXIT] will no longer be backward compatible and older code using [macroref BOOST_SCOPE_EXIT] might no longer compile (if data members were explicitly captured).
+
+[endsect]
+
+[section Template Workaround (GCC)]
+
+Various versions of the GCC compiler do not compile [macroref BOOST_SCOPE_EXIT] inside templates (see the __Reference__ section for more information).
+As a workaround, [macroref BOOST_SCOPE_EXIT_TPL] should be used instead of [macroref BOOST_SCOPE_EXIT] in these cases.
+[footnote
+*Rationale.*
+GCC versions compliant with C++11 do not present this issue and given that [macroref BOOST_SCOPE_EXIT_ALL] is only available on C++11 compilers, there is no need for a `BOOST_SCOPE_EXIT_ALL_TPL` macro.
+]
+The [macroref BOOST_SCOPE_EXIT_TPL] macro has the exact same syntax of [macroref BOOST_SCOPE_EXIT].
+For example (see also [@../../test/world_tpl.cpp =world_tpl.cpp=]):
+
+[world_tpl]
+
+It is recommended to always use [macroref BOOST_SCOPE_EXIT_TPL] within templates so to maximize portability among different compilers.
+
+[endsect]
+
+[section Same Line Expansions]
+
+In general, it is not possible to expand the [macroref BOOST_SCOPE_EXIT], [macroref BOOST_SCOPE_EXIT_TPL], [macroref BOOST_SCOPE_EXIT_END], and [macroref BOOST_SCOPE_EXIT_ALL] macros multiple times on the same line.
+[footnote
+*Rationale.*
+The library macros internally use `__LINE__` to generate unique identifiers.
+Therefore, if the same macro is expanded more than on time on the same line, the generated identifiers will no longer be unique and the code will not compile.
+(This restriction does not apply to MSVC and other compilers that provide the non-standard `__COUNTER__` macro.)
+]
+
+Therefore, this library provides additional macros [macroref BOOST_SCOPE_EXIT_ID], [macroref BOOST_SCOPE_EXIT_ID_TPL], [macroref BOOST_SCOPE_EXIT_END_ID], and [macroref BOOST_SCOPE_EXIT_ALL_ID] which can be expanded multiple times on the same line as long as programmers specify a unique identifiers as the macros' first parameters.
+The unique identifier can be any token (not just numeric) that can be concatenated by the C++ preprocessor (e.g., `scope_exit_number_1_at_line_123`).
+[footnote
+Because there are restrictions on the set of tokens that the C++ preprocessor can concatenate and because not all compilers correctly implement these restrictions, it is in general recommended to specify unique identifiers as a combination of alphanumeric tokens.
+]
+
+The [macroref BOOST_SCOPE_EXIT_ID], [macroref BOOST_SCOPE_EXIT_ID_TPL], and [macroref BOOST_SCOPE_EXIT_ALL_ID] macros accept a capture list using the exact same syntax as [macroref BOOST_SCOPE_EXIT] and [macroref BOOST_SCOPE_EXIT_ALL] respectively.
+For example (see also [@../../test/same_line.cpp =same_line.cpp=]):
+
+[same_line]
+
+As shown by the example above, the [macroref BOOST_SCOPE_EXIT_ID], [macroref BOOST_SCOPE_EXIT_ID_TPL], [macroref BOOST_SCOPE_EXIT_END_ID], and [macroref BOOST_SCOPE_EXIT_ALL_ID] macros are especially useful when it is necessary to invoke them multiple times within user-defined macros (because the C++ preprocessor expands all nested macros on the same line).
+
+[endsect]
+
+[endsect]
+
+[section:alternatives Annex: Alternatives]
+
+This section presents some alternative and related work to __Boost_ScopeExit__.
+
+[heading Try-Catch]
+
+This is an example of using a badly designed `file` class.
+An instance of `file` does not close the file in its destructor, a programmer is expected to call the `close` member function explicitly.
+For example (see also [@../../example/try_catch.cpp =try_catch.cpp=]):
+
+[try_catch_bad]
+
+Note the following issues with this approach:
+
+# The `passwd` object is defined outside of the `try` block because this object is required inside the `catch` block to close the file.
+# The `passwd` object is not fully constructed until after the `open`
+member function returns.
+# If opening throws, the `passwd.close()` should not be called, hence the call to `passwd.is_open()`.
+
+The __Boost_ScopeExit__ approach does not have any of these issues.
+For example (see also [@../../example/try_catch.cpp =try_catch.cpp=]):
+
+[try_catch_good]
+
+[heading RAII]
+
+__RAII__ is absolutely perfect for the `file` class introduced above.
+Use of a properly designed `file` class would look like:
try {
- File passwd("/etc/passwd");
+ file passwd("/etc/passwd");
// ...
- }
- catch(...) {
- log("could not get user info");
+ } catch(...) {
+ std::clog << "could not get user info" << std::endl;
throw;
}
-However, using _RAII_ to build up a _strong_guarantee_ could introduce
-a lot of non-reusable _RAII_ types. For example:
+However, using __RAII__ to build up a __strong_guarantee__ could introduce a lot of non-reusable __RAII__ types.
+For example:
- m_persons.push_back(person);
- pop_back_if_not_commit pop_back_if_not_commit_guard(commit, m_persons);
+ persons_.push_back(a_person);
+ pop_back_if_not_commit pop_back_if_not_commit_guard(commit, persons_);
-The `pop_back_if_not_commit` class is either defined out of the scope or
-as a local class:
+The `pop_back_if_not_commit` class is either defined out of the scope or as a local class:
class pop_back_if_not_commit {
- bool m_commit;
- std::vector<Person>& m_vec;
+ bool commit_;
+ std::vector<person>& vec_;
// ...
~pop_back_if_not_commit() {
- if(!m_commit)
- m_vec.pop_back();
+ if(!commit_) vec_.pop_back();
}
};
-In some cases _strong_guarantee_ can be accomplished with standard utilities:
+In some cases __strong_guarantee__ can be accomplished with standard utilities:
- std::auto_ptr<Person> spSuperMan(new Superman);
- m_persons.push_back(spSuperMan.get());
- spSuperMan.release(); // m_persons successfully took ownership.
+ std::auto_ptr<Person> superman_ptr(new superman());
+ persons_.push_back(superman_ptr.get());
+ superman_ptr.release(); // persons_ successfully took ownership
-or with specialized containers such as _ptr_container_ or
-_multi_index_.
+Or with specialized containers such as __Boost_PointerContainer__ or __Boost_Multi_Index__.
-[h3 _scope_guard_]
+[heading Scope Guards]
-Imagine that you add a new currency rate:
+Imagine that a new currency rate is introduced before performing a transaction (see also []):
- bool commit = false;
- std::string currency("EUR");
- double rate = 1.3326;
- std::map<std::string, double> rates;
- bool currency_rate_inserted =
- rates.insert(std::make_pair(currency, rate)).second;
-
-and then continue a transaction. If it cannot be completed, you erase
-the currency from `rates`. This is how you can do this with _scope_guard_
-and _lambda_:
+[scope_guard_decl]
- using namespace boost::lambda;
+If the transaction does not complete, the currency must be erased from `rates`.
+This can be done with __ScopeGuard__ and __Boost_Lambda__ (or __Boost_Phoenix__):
- ON_BLOCK_EXIT(
- if_(currency_rate_inserted && !_1) [
- bind(
- static_cast<
- std::map<std::string,double>::size_type (std::map<std::string,double>::*)(std::string const&)
- >(&std::map<std::string,double>::erase)
- , &rates
- , currency
- )
- ]
- , boost::cref(commit)
- );
-
- // ...
-
- commit = true;
-
-Note that
-
-* Boost.lambda expressions are hard to write correctly, for example,
-overloaded function must be explicitly casted, as demonstrated in
-this example,
-* condition in `if_` expression refers to `commit` variable indirectly
-through the `_1` placeholder,
-* setting a breakpoint inside `if_[ ... ]` requires in-depth knowledge
-of _lambda_ and debugging techniques.
-
-This code will look much better with native lambda expressions proposed
-for C++0x:
-
- ON_BLOCK_EXIT(
- [currency_rate_inserted, &commit, &rates, &currency]() -> void
- {
- if(currency_rate_inserted && !commit)
- rates.erase(currency);
- }
- );
+ using namespace boost::lambda;
-With _scope_exit_ you can simply do
+ ON_BLOCK_EXIT(
+ if_(currency_rate_inserted && !_1) [
+ bind(
+ static_cast<
+ std::map<std::string, double>::size_type
+ (std::map<std::string, double>::*)(std::string const&)
+ >(&std::map<std::string, double>::erase)
+ , &rates
+ , currency
+ )
+ ]
+ , boost::cref(commit)
+ );
- BOOST_SCOPE_EXIT( (currency_rate_inserted)(&commit)(&rates)(&currency) )
- {
- if(currency_rate_inserted && !commit)
- rates.erase(currency);
- } BOOST_SCOPE_EXIT_END
-
- // ...
-
- commit = true;
+ // ...
-[h3 C++0x]
+ commit = true;
-In future releases _scope_exit_ will take advantages of C++0x features.
+Note the following issues with this approach:
-* Passing capture list as _pp_seq_ will be replaced with a traditional
-macro invocation style:
+# __Boost_Lambda__ expressions are hard to write correctly (e.g., overloaded functions must be explicitly casted, as demonstrated in the example above).
+# The condition in the `if_` expression refers to `commit` variable indirectly through the `_1` placeholder reducing readability.
+# Setting a breakpoint inside `if_[...]` requires in-depth knowledge of __Boost_Lambda__ and debugging techniques.
- BOOST_SCOPE_EXIT(currency_rate_inserted, &commit, &rates, &currency)
- {
- if(currency_rate_inserted && !commit)
- rates.erase(currency);
- } BOOST_SCOPE_EXIT_END
-
-* `BOOST_SCOPE_EXIT_END` will be replaced with a semicolon:
+This code will look much better with C++11 lambdas:
- BOOST_SCOPE_EXIT(currency_rate_inserted, &commit, &rates, &currency)
- {
- if(currency_rate_inserted && !commit)
- rates.erase(currency);
- };
+ ON_BLOCK_EXIT(
+ [currency_rate_inserted, &commit, &rates, &currency]() {
+ if(currency_rate_inserted && !commit) rates.erase(currency);
+ }
+ );
+
+ // ...
+
+ commit = true;
-* Users will be able to capture local variables implicitly with lambda
-capture defaults `&` and `=`:
+With __Boost_ScopeExit__ we can simply do the following (see also [@../../example/scope_guard.cpp =scope_guard.cpp=]):
- BOOST_SCOPE_EXIT(&, currency_rate_inserted)
- {
- if(currency_rate_inserted && !commit)
- rates.erase(currency);
- };
+[scope_guard_exit]
-* It will be possible to capture `this` pointer.
+[heading The D Programming Language]
-[h3 The D Programming Language]
+__Boost_ScopeExit__ is similar to __D_scope_exit__ feature built into the __D__ programming language.
-_ScopeExit_ is similar to _D_scope_exit_ feature built
-into the _D_ programming language.
+A curious reader may notice that the library does not implement `scope(success)` and `scope(failure)` of the __D__ language.
+Unfortunately, these are not possible in C++ because failure or success conditions cannot be determined by calling `std::uncaught_exception` (see [@http://www.gotw.ca/gotw/047.htm Guru of the Week #47] for details about `std::uncaught_exception` and if it has any good use at all).
+However, this is not a big problem because these two __D__'s constructs can be expressed in terms of __D_scope_exit__ and a `bool commit` variable (similarly to some examples presented in the __Tutorial__ section).
-A curious reader may notice that the library doesn't implement
-`scope(success)` and `scope(failure)` of the _D_ language.
-Unfortunately, it's not possible in C++ because failure or success
-condition cannot be determined by calling `std::uncaught_exception`.
-It's not a big problem, though. These two constructs can be
-expressed in terms of _D_scope_exit_ and a `bool commit` variable
-as explained in _Tutorial_. Refer to
-[@http://www.gotw.ca/gotw/047.htm Guru of the Week #47]
-for more details about `std::uncaught_exception` and if it has
-any good use at all.
+[heading C++11 Lambdas]
-[endsect]
+Using C++11 lambdas, it is relatively easy to implement the __Boost_ScopeExit__ construct.
+For example (see also [@../../example/world_cxx11_lambda.cpp =world_cxx11_lambda.cpp=]):
-[section:compilers Supported Compilers]
+[world_cxx11_lambda]
-The library should be usable on any compiler that supports _typeof_
-except
+However, this library allows to program the __Boost_ScopeExit__ construct in a way that is portable between C++03 and C++11 compilers.
-* MSVC 7.1 and 8.0 fail to link if a function with _scope_exit_
-is included by multiple translation units.
-* GCC 3.3 can't compile _scope_exit_ inside a template. See
-[@http://lists.boost.org/Archives/boost/2007/02/116235.php this thread]
-for more details.
+[endsect]
-The author tested the library on GCC 3.3, 3.4, 4.1, 4.2 and Intel 10.1.
+[section:no_variadic_macros Annex: No Variadic Macros]
-[endsect]
+This section presents an alternative syntax for compilers without variadic macro support.
-[section:conf Configuration]
+[heading Sequence Syntax]
-Normally, no configuration is required for the library but
-note that the library depends on _typeof_ and you may want
-to configure or enforce _typeof_emulation_.
+Most modern compilers support variadic macros (notably, these include GCC, MSVC, and all C++11 compilers).
+[footnote
+A C++ compiler does not support variadic macros if the __Boost_Config__ macro `BOOST_NO_VARIADIC_MACROS` is defined for that compiler.
+]
+However, in the rare case that programmers need to use this library on a complier without variaidc macros, this library also allows to specify the capture list using a __Boost_Preprocessor__ sequence where tokens are separated by round parenthesis `()`:
-[endsect]
+ (capture1) (capture2) ... // All compilers.
-[section:ref Reference]
+Instead of the comma-separated list that we have seen so far which requires variadic macros:
-[h3 BOOST_SCOPE_EXIT]
+ capture1, capture2, ... // Only compilers with variadic macros.
-A _scope_exit_ declaration has the following synopsis:
+For example, the following syntax is accepted on all compilers with and without variadic macros (see also [@../../test/world_seq.cpp =world_seq.cpp=] and [@../../test/world.cpp =world.cpp=]):
- #include <boost/scope_exit.hpp>
+[table
+[ [Boost.Preprocessor Sequence (All Compilers)] [Comma-Separated List (Variadic Macros Only)] ]
+[ [[world_seq]] [[world]] ]
+]
- BOOST_SCOPE_EXIT ( scope-exit-capture-list )
- function-body
- BOOST_SCOPE_EXIT_END
+Note how the same macros accept both syntaxes on compilers with variadic macros and only the __Boost_Preprocessor__ sequence syntax on compilers without variadic macros.
+Older versions of this library used to only support the __Boost_Preprocessor__ sequence syntax so this syntax is supported also for backward compatibility.
+However, in the current version of this library and on compilers with variadic macros, the comma-separated syntax is preferred because it is more readable.
-where
+Finally, an empty capture list is always specified using `void` on compilers with and without variaidc macros (see also [@../../test/world_void.cpp =world_void.cpp=]):
- scope-exit-capture-list:
- ( scope-exit-capture )
- scope-exit-capture-list ( scope-exit-capture )
-
- scope-exit-capture:
- identifier
- &identifier
-
-The _scope_exit_ declaration schedules an execution of `scope-exit-body`
-at the end of the current scope. The `scope-exit-body` statements are
-executed in the reverse order of _scope_exit_ declarations in the given
-scope. The scope must be local.
-
-Each `identifier` in `scope-exit-capture-list` must be a valid name
-in enclosing scope and it must appear exactly once in the list.
-If a `scope-exit-capture` starts with the ampersand sign `&`, the
-corresponding `identifier` will be available inside `scope-exit-body`;
-otherwise, a copy of it will be made at the point of _scope_exit_
-declaration and that copy will be available inside `scope-exit-body`.
-In the latter case, the `idenitifer` must be `CopyConstructible`.
-
-Only identifiers listed in `scope-exit-capture-list`, static variables,
-`extern` variables and functions, and enumerations from the enclosing
-scope can be used inside the `scope-exit-body`.
-
-[note `this` pointer is not an identifier and cannot be passed to
-` scope-exit-capture-list`.]
-
-The _scope_exit_ uses _typeof_ to determine types of
-`scope-exit-capture-list` elements. In order to compile code in
-_typeof_emulation_ mode, all types should be registered with
-_typeof_REGISTER_TYPE_ or _typeof_REGISTER_TEMPLATE_ macros,
-or appropriate _typeof_ headers should be included.
-
-[h3 BOOST_SCOPE_EXIT_TPL]
-
-This macro is a workaround for various versions of gcc. These compilers
-don't compile _scope_exit_ declaration inside function templates. As a
-workaround, the `_TPL` suffix should be appended to `BOOST_SCOPE_EXIT`.
-
-The problem boils down to the following code:
-
- template<class T> void foo(T const& t) {
- int i = 0;
- struct Local {
- typedef __typeof__(i) typeof_i;
- typedef __typeof__(t) typeof_t;
- };
- typedef Local::typeof_i i_type;
- typedef Local::typeof_t t_type;
- }
-
- int main() { foo(0); }
+[world_void]
-This can be fixed by adding `typename` in front of `Local::typeof_i` and
-`Local::typeof_t`.
+[heading Examples]
-See also [@http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37920 GCC bug 37920].
+For reference, the following is a list of most of the examples presented in this documentation reprogrammed using the __Boost_Preprocessor__ sequence syntax instead of comma-separated lists (in alphabetic order):
-[note Although `BOOST_SCOPE_EXIT_TPL` has the same suffix as the
-`BOOST_TYPEOF_TPL`, it doesn't follow a convention of the _typeof_.]
+[table
+ [ [Files] ]
+ [ [[@../../test/same_line_seq.cpp =same_line_seq.cpp=]] ]
+ [ [[@../../example/scope_guard_seq.cpp =scope_guard_seq.cpp=]] ]
+ [ [[@../../example/try_catch_seq.cpp =try_catch_seq.cpp=]] ]
+ [ [[@../../test/world_checkpoint_all_seq.cpp =world_checkpoint_all_seq.cpp=]] ]
+ [ [[@../../test/world_checkpoint_seq.cpp =world_checkpoint_seq.cpp=]] ]
+ [ [[@../../test/world_this_seq.cpp =world_this_seq.cpp=]] ]
+ [ [[@../../test/world_tpl_seq.cpp =world_tpl_seq.cpp=]] ]
+]
[endsect]
-[section:acknowledge Acknowledge]
+[xinclude reference.xml]
+
+[section Acknowledgements]
-(in chronological order)
+Alexander Nasonov is the original library author.
-Maxim Yegorushkin for sending me a code where he used a local struct
-to clean up resources.
+Lorenzo Caminiti added variadic macro support, capture of the object `this_`, empty captures using `void`, and `BOOST_SCOPE_EXIT_ALL`.
-Andrei Alexandrescu for pointing me to _D_scope_exit_ construct of
-the _D_ programming language.
+Thanks to the following people (in chronological order):
-Pavel Vozenilek and Maxim Yanchenko for reviews of early drafts of
-the library.
+Maxim Yegorushkin for sharing code where he used a local struct to clean up resources;
-Steven Watanabe for his valuable ideas.
+Andrei Alexandrescu for pointing out the __D_scope_exit__ construct of the __D__ programming language;
-Jody Hagins for good comments that helped to significantly improve the documentation.
+Pavel Vozenilek and Maxim Yanchenko for reviews of early drafts of the library;
-Richard Webb for testing the library on MSVC compiler.
+Steven Watanabe for his valuable ideas;
+
+Jody Hagins for good comments that helped to significantly improve the documentation;
+
+Richard Webb for testing the library on MSVC compiler;
+
+Adam Butcher for a workaround to error C2355 when deducing the type of `this` on some MSVC versions.
[endsect]
+
diff --git a/libs/scope_exit/example/Jamfile.v2 b/libs/scope_exit/example/Jamfile.v2
new file mode 100644
index 0000000000..82db03a52e
--- /dev/null
+++ b/libs/scope_exit/example/Jamfile.v2
@@ -0,0 +1,23 @@
+
+# Copyright (C) 2006-2009, 2012 Alexander Nasonov
+# Copyright (C) 2012 Lorenzo Caminiti
+# Distributed under the Boost Software License, Version 1.0
+# (see accompanying file LICENSE_1_0.txt or a copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# Home at http://www.boost.org/libs/scope_exit
+
+import testing ;
+
+# Sun does not automatically detect type-of emulation mode (force it).
+project : requirements <toolset>sun:<define>BOOST_TYPEOF_EMULATION ;
+
+run try_catch.cpp ;
+run try_catch_seq.cpp ;
+run try_catch_seq_nova.cpp ;
+
+run scope_guard.cpp ;
+run scope_guard_seq.cpp ;
+run scope_guard_seq_nova.cpp ;
+
+run world_cxx11_lambda.cpp ;
+
diff --git a/libs/scope_exit/example/nova.hpp b/libs/scope_exit/example/nova.hpp
new file mode 100644
index 0000000000..58984acd89
--- /dev/null
+++ b/libs/scope_exit/example/nova.hpp
@@ -0,0 +1,21 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#ifndef NOVA_HPP_
+#define NOVA_HPP_
+
+#include <boost/config.hpp>
+
+// WARNING: This file must be included first in each compilation unit.
+
+// Force no variadic macros but avoiding macro redefinition warning/error.
+#ifndef BOOST_NO_VARIADIC_MACROS
+# define BOOST_NO_VARIADIC_MACROS
+#endif
+
+#endif // #include guard
+
diff --git a/libs/scope_exit/example/scope_guard.cpp b/libs/scope_exit/example/scope_guard.cpp
new file mode 100644
index 0000000000..ad090ac956
--- /dev/null
+++ b/libs/scope_exit/example/scope_guard.cpp
@@ -0,0 +1,46 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/std/string.hpp>
+#include <boost/typeof/std/map.hpp>
+#include <map>
+#include <string>
+#include <utility>
+
+int main(void) {
+ //[scope_guard_decl
+ bool commit = false;
+ std::string currency("EUR");
+ double rate = 1.3326;
+ std::map<std::string, double> rates;
+ bool currency_rate_inserted =
+ rates.insert(std::make_pair(currency, rate)).second;
+ // Transaction...
+ //]
+
+ //[scope_guard_exit
+ BOOST_SCOPE_EXIT(currency_rate_inserted, &commit, &rates, &currency) {
+ if(currency_rate_inserted && !commit) rates.erase(currency);
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ commit = true;
+ //]
+
+ return 0;
+}
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/example/scope_guard_seq.cpp b/libs/scope_exit/example/scope_guard_seq.cpp
new file mode 100644
index 0000000000..167cd719ca
--- /dev/null
+++ b/libs/scope_exit/example/scope_guard_seq.cpp
@@ -0,0 +1,35 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/std/string.hpp>
+#include <boost/typeof/std/map.hpp>
+#include <map>
+#include <string>
+#include <utility>
+
+int main(void) {
+ bool commit = false;
+ std::string currency("EUR");
+ double rate = 1.3326;
+ std::map<std::string, double> rates;
+ bool currency_rate_inserted =
+ rates.insert(std::make_pair(currency, rate)).second;
+
+ BOOST_SCOPE_EXIT( (currency_rate_inserted) (&commit) (&rates)
+ (&currency) ) {
+ if(currency_rate_inserted && !commit) rates.erase(currency);
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ commit = true;
+
+ return 0;
+}
+
diff --git a/libs/scope_exit/example/scope_guard_seq_nova.cpp b/libs/scope_exit/example/scope_guard_seq_nova.cpp
new file mode 100644
index 0000000000..2289a932c6
--- /dev/null
+++ b/libs/scope_exit/example/scope_guard_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "scope_guard_seq.cpp"
+
diff --git a/libs/scope_exit/example/try_catch.cpp b/libs/scope_exit/example/try_catch.cpp
new file mode 100644
index 0000000000..327a1c6617
--- /dev/null
+++ b/libs/scope_exit/example/try_catch.cpp
@@ -0,0 +1,68 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <iostream>
+
+struct file {
+ file(void) : open_(false) {}
+ file(char const* path) : open_(false) { open(path); }
+
+ void open(char const* path) { open_ = true; }
+ void close(void) { open_ = false; }
+ bool is_open(void) const { return open_; }
+
+private:
+ bool open_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(file)
+
+void bad(void) {
+ //[try_catch_bad
+ file passwd;
+ try {
+ passwd.open("/etc/passwd");
+ // ...
+ passwd.close();
+ } catch(...) {
+ std::clog << "could not get user info" << std::endl;
+ if(passwd.is_open()) passwd.close();
+ throw;
+ }
+ //]
+}
+
+void good(void) {
+ //[try_catch_good
+ try {
+ file passwd("/etc/passwd");
+ BOOST_SCOPE_EXIT(&passwd) {
+ passwd.close();
+ } BOOST_SCOPE_EXIT_END
+ } catch(...) {
+ std::clog << "could not get user info" << std::endl;
+ throw;
+ }
+ //]
+}
+
+int main(void) {
+ bad();
+ good();
+ return 0;
+}
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/example/try_catch_seq.cpp b/libs/scope_exit/example/try_catch_seq.cpp
new file mode 100644
index 0000000000..8ff7ea5f5c
--- /dev/null
+++ b/libs/scope_exit/example/try_catch_seq.cpp
@@ -0,0 +1,61 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <iostream>
+
+struct file {
+ file(void) : open_(false) {}
+ file(char const* path) : open_(false) { open(path); }
+
+ void open(char const* path) { open_ = true; }
+ void close(void) { open_ = false; }
+ bool is_open(void) const { return open_; }
+
+private:
+ bool open_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(file)
+
+void bad(void) {
+ //[try_catch_bad_seq
+ file passwd;
+ try {
+ passwd.open("/etc/passwd");
+ // ...
+ passwd.close();
+ } catch(...) {
+ std::clog << "could not get user info" << std::endl;
+ if(passwd.is_open()) passwd.close();
+ throw;
+ }
+ //]
+}
+
+void good(void) {
+ //[try_catch_good_seq
+ try {
+ file passwd("/etc/passwd");
+ BOOST_SCOPE_EXIT( (&passwd) ) {
+ passwd.close();
+ } BOOST_SCOPE_EXIT_END
+ } catch(...) {
+ std::clog << "could not get user info" << std::endl;
+ throw;
+ }
+ //]
+}
+
+int main(void) {
+ bad();
+ good();
+ return 0;
+}
+
diff --git a/libs/scope_exit/example/try_catch_seq_nova.cpp b/libs/scope_exit/example/try_catch_seq_nova.cpp
new file mode 100644
index 0000000000..70f0043a44
--- /dev/null
+++ b/libs/scope_exit/example/try_catch_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "try_catch_seq.cpp"
+
diff --git a/libs/scope_exit/example/world.cpp b/libs/scope_exit/example/world.cpp
deleted file mode 100644
index 2117f6395c..0000000000
--- a/libs/scope_exit/example/world.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright Alexander Nasonov 2009
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <vector>
-#include <ostream>
-
-#include <boost/foreach.hpp>
-#include <boost/scope_exit.hpp>
-
-// The following is required for typeof emulation mode:
-#include <boost/typeof/typeof.hpp>
-#include <boost/typeof/std/vector.hpp>
-#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-
-class World;
-class Person
-{
- friend class World;
-public:
- typedef unsigned int id_t;
- typedef unsigned int evolution_t;
-
- Person()
- : m_id(0)
- , m_evolution(0)
- {}
-
- friend std::ostream& operator<<(std::ostream& o, Person const& p)
- {
- return o << "Person(" << p.m_id << ", " << p.m_evolution << ')';
- }
-private:
- id_t m_id;
- evolution_t m_evolution;
-};
-
-BOOST_TYPEOF_REGISTER_TYPE(Person)
-
-class World
-{
-public:
- typedef unsigned int id_t;
-
- World()
- : m_next_id(1)
- {}
- void addPerson(Person const& aPerson);
-
- friend std::ostream& operator<<(std::ostream& o, World const& w)
- {
- o << "World(" << w.m_next_id << ", {";
- BOOST_FOREACH(Person const& p, w.m_persons)
- {
- o << ' ' << p << ',';
- }
- return o << "})";
- }
-private:
- id_t m_next_id;
- std::vector<Person> m_persons;
-};
-
-BOOST_TYPEOF_REGISTER_TYPE(World)
-
-void World::addPerson(Person const& aPerson) {
- m_persons.push_back(aPerson);
-
- // This block must be no-throw
- Person& person = m_persons.back();
- Person::evolution_t checkpoint = person.m_evolution;
-
- BOOST_SCOPE_EXIT( (checkpoint)(&person)(&m_persons) )
- {
- if(checkpoint == person.m_evolution)
- m_persons.pop_back();
- } BOOST_SCOPE_EXIT_END
-
- // ...
-
- checkpoint = ++person.m_evolution;
-
- // Assign new id to the person
- World::id_t const prev_id = person.m_id;
- person.m_id = m_next_id++;
- BOOST_SCOPE_EXIT( (checkpoint)(&person)(&m_next_id)(prev_id) )
- {
- if(checkpoint == person.m_evolution) {
- m_next_id = person.m_id;
- person.m_id = prev_id;
- }
- } BOOST_SCOPE_EXIT_END
-
- // ...
-
- checkpoint = ++person.m_evolution;
-}
-
-#include <iostream>
-
-int main()
-{
- Person adam, eva;
- std::cout << adam << '\n';
- std::cout << eva << '\n';
-
- World w;
- w.addPerson(adam);
- w.addPerson(eva);
- std::cout << w << '\n';
-}
-
diff --git a/libs/scope_exit/example/world_cxx11_lambda.cpp b/libs/scope_exit/example/world_cxx11_lambda.cpp
new file mode 100644
index 0000000000..c3f659ab9f
--- /dev/null
+++ b/libs/scope_exit/example/world_cxx11_lambda.cpp
@@ -0,0 +1,57 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
+
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+
+struct person {};
+
+struct world {
+ void add_person(person const& a_person);
+ std::vector<person> persons_;
+};
+
+//[world_cxx11_lambda
+#include <functional>
+
+struct scope_exit {
+ scope_exit(std::function<void (void)> f) : f_(f) {}
+ ~scope_exit(void) { f_(); }
+private:
+ std::function<void (void)> f_;
+};
+
+void world::add_person(person const& a_person) {
+ bool commit = false;
+
+ persons_.push_back(a_person);
+ scope_exit on_exit1([&commit, this](void) { // Use C++11 lambda.
+ if(!commit) persons_.pop_back(); // `persons_` via captured `this`.
+ });
+
+ // ...
+
+ commit = true;
+}
+//]
+
+int main(void) {
+ world w;
+ person p;
+ w.add_person(p);
+ BOOST_TEST(w.persons_.size() == 1);
+ return boost::report_errors();
+}
+
+#endif // LAMBDAS
+
diff --git a/libs/scope_exit/index.html b/libs/scope_exit/index.html
index a7e29a8258..c28485bd76 100644
--- a/libs/scope_exit/index.html
+++ b/libs/scope_exit/index.html
@@ -1,16 +1,15 @@
-
-<!--
-Copyright 2009 Alexander Nasonov.
-Distributed under the Boost Software License, Version 1.0. (See accompanying
-file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
--->
-
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
-<head>
+ <head>
<meta http-equiv="refresh" content="0; URL=doc/html/index.html">
-</head>
-<body>
-Automatic redirection failed, please go to
-<a href="doc/html/index.html">doc/html/index.html</a>
-</body>
+ </head>
+ <body>
+ Automatic redirection failed, click this
+ <a href="doc/html/index.html">link</a> &nbsp;<hr>
+ <p>© Copyright Alexander Nasonov, Lorenzo Caminiti, 2006-2012</p>
+ <p>Distributed under the Boost Software License, Version 1.0 (see
+ accompanying file <a href="../../LICENSE_1_0.txt">
+ LICENSE_1_0.txt</a> or a copy at
+ <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+ </body>
</html>
diff --git a/libs/scope_exit/test/Jamfile.v2 b/libs/scope_exit/test/Jamfile.v2
index b918534935..d27e8b40db 100644
--- a/libs/scope_exit/test/Jamfile.v2
+++ b/libs/scope_exit/test/Jamfile.v2
@@ -1,25 +1,53 @@
-# Copyright Alexander Nasonov 2007
-#
-# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-# TODO: get rid of dummy .cpp files that only #include other .cpp file.
+# Copyright (C) 2006-2009, 2012 Alexander Nasonov
+# Copyright (C) 2012 Lorenzo Caminiti
+# Distributed under the Boost Software License, Version 1.0
+# (see accompanying file LICENSE_1_0.txt or a copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# Home at http://www.boost.org/libs/scope_exit
import testing ;
-run native.cpp ../../../libs/test/build//boost_test_exec_monitor : : : <define>BOOST_TYPEOF_NATIVE : ;
-run emulation.cpp ../../../libs/test/build//boost_test_exec_monitor : : : <define>BOOST_TYPEOF_EMULATION : ;
-
-run native_tpl.cpp ../../../libs/test/build//boost_test_exec_monitor : : : <define>BOOST_TYPEOF_NATIVE : ;
-run emulation_tpl.cpp ../../../libs/test/build//boost_test_exec_monitor : : : <define>BOOST_TYPEOF_EMULATION : ;
-
-compile-fail native_const_error.cpp : <define>BOOST_TYPEOF_NATIVE ;
-compile-fail emulation_const_error.cpp : <define>BOOST_TYPEOF_EMULATION ;
-
-compile-fail native_cv_error.cpp : <define>BOOST_TYPEOF_NATIVE ;
-compile-fail emulation_cv_error.cpp : <define>BOOST_TYPEOF_EMULATION ;
-
-run native_tu_test.cpp native_tu1.cpp native_tu2.cpp ../../../libs/test/build//boost_test_exec_monitor : : : <define>BOOST_TYPEOF_NATIVE : ;
-run emulation_tu_test.cpp native_tu1.cpp native_tu2.cpp ../../../libs/test/build//boost_test_exec_monitor : : : <define>BOOST_TYPEOF_EMULATION : ;
+rule run-vaseq ( command target )
+{
+ # Sun does not automatically detect type-of emulation mode (force it).
+ run $(target).cpp : : : <toolset>sun:<define>BOOST_TYPEOF_EMULATION ;
+ run $(target)_seq.cpp : : : <toolset>sun:<define>BOOST_TYPEOF_EMULATION ;
+ run $(target)_seq_nova.cpp : : :
+ <toolset>sun:<define>BOOST_TYPEOF_EMULATION ;
+}
+
+rule run-typeof ( native_target emulation_target )
+{
+ run $(native_target).cpp : : : <define>BOOST_TYPEOF_NATIVE ;
+ run $(native_target).cpp : : : <define>BOOST_TYPEOF_EMULATION :
+ $(emulation_target) : ;
+}
+
+rule compile-fail-typeof ( native_target emulation_target )
+{
+ compile-fail $(native_target).cpp : <define>BOOST_TYPEOF_NATIVE ;
+ compile-fail $(native_target).cpp : <define>BOOST_TYPEOF_EMULATION :
+ $(emulation_target) : ;
+}
+
+run-vaseq run same_line ;
+run-vaseq run world ;
+run-vaseq run world_checkpoint ;
+run-vaseq run world_checkpoint_all ;
+run-vaseq run world_this ;
+run-vaseq run world_tpl ;
+run world_void.cpp ;
+run world_void_nova.cpp ;
+
+run-typeof native emulation ;
+run-typeof native_tpl emulation_tpl ;
+run-typeof native_this emulation_this ;
+run-typeof native_this_tpl emulation_this_tpl ;
+compile-fail-typeof native_const_error emulation_const_error ;
+compile-fail-typeof native_cv_error emulation_cv_error ;
+run native_tu_test.cpp native_tu1.cpp native_tu2.cpp : : :
+ <define>BOOST_TYPEOF_NATIVE ;
+run native_tu_test.cpp native_tu1.cpp native_tu2.cpp : : :
+ <define>BOOST_TYPEOF_EMULATION : emulation_tu_test : ;
diff --git a/libs/scope_exit/test/emulation.cpp b/libs/scope_exit/test/emulation.cpp
deleted file mode 100644
index 865739c62e..0000000000
--- a/libs/scope_exit/test/emulation.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright Alexander Nasonov 2007-2009
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include "native.cpp"
-
diff --git a/libs/scope_exit/test/emulation_const_error.cpp b/libs/scope_exit/test/emulation_const_error.cpp
deleted file mode 100644
index 805ba6f499..0000000000
--- a/libs/scope_exit/test/emulation_const_error.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright Alexander Nasonov 2007-2009
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include "native_const_error.cpp"
diff --git a/libs/scope_exit/test/emulation_cv_error.cpp b/libs/scope_exit/test/emulation_cv_error.cpp
deleted file mode 100644
index a4134c9cd0..0000000000
--- a/libs/scope_exit/test/emulation_cv_error.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright Alexander Nasonov 2007-2009
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include "native_cv_error.cpp"
diff --git a/libs/scope_exit/test/emulation_tpl.cpp b/libs/scope_exit/test/emulation_tpl.cpp
deleted file mode 100644
index d568f26a10..0000000000
--- a/libs/scope_exit/test/emulation_tpl.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright Alexander Nasonov 2007-2009
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include "native_tpl.cpp"
-
diff --git a/libs/scope_exit/test/emulation_tu_test.cpp b/libs/scope_exit/test/emulation_tu_test.cpp
deleted file mode 100644
index 5e59534ba4..0000000000
--- a/libs/scope_exit/test/emulation_tu_test.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright Alexander Nasonov 2007-2009
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include "native_tu_test.cpp"
diff --git a/libs/scope_exit/test/native.cpp b/libs/scope_exit/test/native.cpp
index 629e0073aa..133060eb75 100644
--- a/libs/scope_exit/test/native.cpp
+++ b/libs/scope_exit/test/native.cpp
@@ -1,135 +1,121 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-#include <iostream>
-#include <ostream>
-#include <string>
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
#include <boost/scope_exit.hpp>
-
+#include <boost/config.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/string.hpp>
-#include <boost/test/unit_test.hpp>
-
-using namespace boost::unit_test;
+#include <boost/detail/lightweight_test.hpp>
+#include <iostream>
+#include <ostream>
+#include <string>
std::string g_str;
template<int Dummy = 0>
-struct Holder
-{
+struct Holder {
static long g_long;
};
template<int Dummy> long Holder<Dummy>::g_long;
-void test_non_local()
-{
+void test_non_local(void) {
// ... and one local variable as well:
int i = 0;
- BOOST_SCOPE_EXIT( (i) )
- {
- BOOST_CHECK(i == 0);
- BOOST_CHECK(Holder<>::g_long == 3);
- BOOST_CHECK(g_str == "try: g_str");
+ BOOST_SCOPE_EXIT(void) {
+ BOOST_TEST(Holder<>::g_long == 3);
} BOOST_SCOPE_EXIT_END
- BOOST_SCOPE_EXIT( (&i) )
- {
- BOOST_CHECK(i == 3);
- BOOST_CHECK(Holder<>::g_long == 3);
- BOOST_CHECK(g_str == "try: g_str");
+ BOOST_SCOPE_EXIT( (i) ) {
+ BOOST_TEST(i == 0);
+ BOOST_TEST(Holder<>::g_long == 3);
+ BOOST_TEST(g_str == "try: g_str");
+ } BOOST_SCOPE_EXIT_END
+
+ BOOST_SCOPE_EXIT( (&i) ) {
+ BOOST_TEST(i == 3);
+ BOOST_TEST(Holder<>::g_long == 3);
+ BOOST_TEST(g_str == "try: g_str");
} BOOST_SCOPE_EXIT_END
{
g_str = "";
Holder<>::g_long = 1;
- BOOST_SCOPE_EXIT( (&i) )
- {
+ BOOST_SCOPE_EXIT( (&i) ) {
i = 1;
g_str = "g_str";
} BOOST_SCOPE_EXIT_END
- BOOST_SCOPE_EXIT( (&i) )
- {
- try
- {
- i = 2;
- Holder<>::g_long = 2;
- throw 0;
- } catch(...) {}
+ BOOST_SCOPE_EXIT( (&i) ) {
+ try {
+ i = 2;
+ Holder<>::g_long = 2;
+ throw 0;
+ } catch(...) {}
} BOOST_SCOPE_EXIT_END
- BOOST_CHECK(i == 0);
- BOOST_CHECK(g_str == "");
- BOOST_CHECK(Holder<>::g_long == 1);
+ BOOST_TEST(i == 0);
+ BOOST_TEST(g_str == "");
+ BOOST_TEST(Holder<>::g_long == 1);
}
- BOOST_CHECK(Holder<>::g_long == 2);
- BOOST_CHECK(g_str == "g_str");
- BOOST_CHECK(i == 1); // Check that first declared is executed last
+ BOOST_TEST(Holder<>::g_long == 2);
+ BOOST_TEST(g_str == "g_str");
+ BOOST_TEST(i == 1); // Check that first declared is executed last.
- BOOST_SCOPE_EXIT( (&i) )
- {
- BOOST_CHECK(i == 3);
- BOOST_CHECK(Holder<>::g_long == 3);
- BOOST_CHECK(g_str == "try: g_str");
+ BOOST_SCOPE_EXIT( (&i) ) {
+ BOOST_TEST(i == 3);
+ BOOST_TEST(Holder<>::g_long == 3);
+ BOOST_TEST(g_str == "try: g_str");
} BOOST_SCOPE_EXIT_END
- BOOST_SCOPE_EXIT( (i) )
- {
- BOOST_CHECK(i == 1);
- BOOST_CHECK(Holder<>::g_long == 3);
- BOOST_CHECK(g_str == "try: g_str");
+ BOOST_SCOPE_EXIT( (i) ) {
+ BOOST_TEST(i == 1);
+ BOOST_TEST(Holder<>::g_long == 3);
+ BOOST_TEST(g_str == "try: g_str");
} BOOST_SCOPE_EXIT_END
- try
- {
- BOOST_SCOPE_EXIT( (&i) )
- {
+ try {
+ BOOST_SCOPE_EXIT( (&i) ) {
i = 3;
g_str = "try: g_str";
} BOOST_SCOPE_EXIT_END
- BOOST_SCOPE_EXIT( (&i) )
- {
+ BOOST_SCOPE_EXIT( (&i) ) {
i = 4;
Holder<>::g_long = 3;
} BOOST_SCOPE_EXIT_END
- BOOST_CHECK(i == 1);
- BOOST_CHECK(g_str == "g_str");
- BOOST_CHECK(Holder<>::g_long == 2);
+ BOOST_TEST(i == 1);
+ BOOST_TEST(g_str == "g_str");
+ BOOST_TEST(Holder<>::g_long == 2);
throw 0;
- }
- catch(int)
- {
- BOOST_CHECK(Holder<>::g_long == 3);
- BOOST_CHECK(g_str == "try: g_str");
- BOOST_CHECK(i == 3); // Check that first declared is executed last
+ } catch(int) {
+ BOOST_TEST(Holder<>::g_long == 3);
+ BOOST_TEST(g_str == "try: g_str");
+ BOOST_TEST(i == 3); // Check that first declared is executed last.
}
}
-bool foo()
-{
- return true;
-}
+bool foo(void) { return true; }
+
+bool foo2(void) { return false; }
-void test_types()
-{
- bool (*pf)() = 0;
- bool (&rf)() = foo;
+void test_types(void) {
+ bool (*pf)(void) = 0;
+ bool (&rf)(void) = foo;
bool results[2] = {};
{
- BOOST_SCOPE_EXIT( (&results)(&pf)(&rf) )
- {
+ BOOST_SCOPE_EXIT( (&results) (&pf) (&rf) ) {
results[0] = pf();
results[1] = rf();
}
@@ -137,36 +123,72 @@ void test_types()
pf = &foo;
- BOOST_CHECK(results[0] == false);
- BOOST_CHECK(results[1] == false);
+ BOOST_TEST(results[0] == false);
+ BOOST_TEST(results[1] == false);
}
- BOOST_CHECK(results[0] == true);
- BOOST_CHECK(results[1] == true);
+ BOOST_TEST(results[0] == true);
+ BOOST_TEST(results[1] == true);
{
- BOOST_SCOPE_EXIT( (&results)(pf) )
- {
+ BOOST_SCOPE_EXIT( (&results) (pf) ) {
results[0] = !pf();
results[1] = !pf();
+ pf = &foo2; // modify a copy
}
BOOST_SCOPE_EXIT_END
pf = 0;
- BOOST_CHECK(results[0] == true);
- BOOST_CHECK(results[1] == true);
+ BOOST_TEST(results[0] == true);
+ BOOST_TEST(results[1] == true);
+ }
+
+ BOOST_TEST(pf == 0);
+ BOOST_TEST(results[0] == false);
+ BOOST_TEST(results[1] == false);
+}
+
+void test_capture_all(void) {
+#ifndef BOOST_NO_LAMBDAS
+ int i = 0, j = 1;
+
+ {
+ BOOST_SCOPE_EXIT_ALL(=) {
+ i = j = 1; // modify copies
+ };
+ }
+ BOOST_TEST(i == 0);
+ BOOST_TEST(j == 1);
+
+ {
+ BOOST_SCOPE_EXIT_ALL(&) {
+ i = 1;
+ j = 2;
+ };
+ BOOST_TEST(i == 0);
+ BOOST_TEST(j == 1);
}
+ BOOST_TEST(i == 1);
+ BOOST_TEST(j == 2);
- BOOST_CHECK(results[0] == false);
- BOOST_CHECK(results[1] == false);
+ {
+ BOOST_SCOPE_EXIT_ALL(=, &j) {
+ i = 2; // modify a copy
+ j = 3;
+ };
+ BOOST_TEST(i == 1);
+ BOOST_TEST(j == 2);
+ }
+ BOOST_TEST(i == 1);
+ BOOST_TEST(j == 3);
+#endif // lambdas
}
-test_suite* init_unit_test_suite( int, char* [] )
-{
- framework::master_test_suite().p_name.value = "Unit test for ScopeExit";
- framework::master_test_suite().add( BOOST_TEST_CASE( &test_non_local ));
- framework::master_test_suite().add( BOOST_TEST_CASE( &test_types ));
- return 0;
+int main(void) {
+ test_non_local();
+ test_types();
+ test_capture_all();
+ return boost::report_errors();
}
diff --git a/libs/scope_exit/test/native_const_error.cpp b/libs/scope_exit/test/native_const_error.cpp
index 8aac45f01a..f162f54ec6 100644
--- a/libs/scope_exit/test/native_const_error.cpp
+++ b/libs/scope_exit/test/native_const_error.cpp
@@ -1,16 +1,16 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
#include <boost/scope_exit.hpp>
-int main()
-{
+int main(void) {
int const i = 0;
- BOOST_SCOPE_EXIT( (&i) )
- {
+ BOOST_SCOPE_EXIT( (&i) ) {
i = 5;
} BOOST_SCOPE_EXIT_END
}
diff --git a/libs/scope_exit/test/native_cv_error.cpp b/libs/scope_exit/test/native_cv_error.cpp
index 58058c363f..f0b7bf2fae 100644
--- a/libs/scope_exit/test/native_cv_error.cpp
+++ b/libs/scope_exit/test/native_cv_error.cpp
@@ -1,21 +1,19 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-#include <string>
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
#include <boost/scope_exit.hpp>
-
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/string.hpp>
+#include <string>
-int main()
-{
+int main(void) {
std::string const volatile s;
- BOOST_SCOPE_EXIT( (&s) )
- {
+ BOOST_SCOPE_EXIT( (&s) ) {
s = "";
} BOOST_SCOPE_EXIT_END
}
diff --git a/libs/scope_exit/test/native_this.cpp b/libs/scope_exit/test/native_this.cpp
new file mode 100644
index 0000000000..ace3d765d6
--- /dev/null
+++ b/libs/scope_exit/test/native_this.cpp
@@ -0,0 +1,43 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/config.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+
+struct this_tester;
+BOOST_TYPEOF_REGISTER_TYPE(this_tester) // Register before `this_` capture.
+
+struct this_tester {
+ void check(void) {
+ value_ = -1;
+
+ BOOST_SCOPE_EXIT( (this_) ) {
+ BOOST_TEST(this_->value_ == 0);
+ } BOOST_SCOPE_EXIT_END
+
+#ifndef BOOST_NO_LAMBDAS
+ BOOST_SCOPE_EXIT_ALL(&, this) {
+ BOOST_TEST(this->value_ == 0);
+ };
+#endif // lambdas
+
+ value_ = 0;
+ }
+
+private:
+ int value_;
+};
+
+int main(void) {
+ this_tester().check();
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/native_this_tpl.cpp b/libs/scope_exit/test/native_this_tpl.cpp
new file mode 100644
index 0000000000..91c9b5fe33
--- /dev/null
+++ b/libs/scope_exit/test/native_this_tpl.cpp
@@ -0,0 +1,45 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/config.hpp>
+#include <boost/typeof/typeof.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+
+template<typename T>
+struct this_tester;
+BOOST_TYPEOF_REGISTER_TEMPLATE(this_tester, 1) // Before`this_` capture.
+
+template<typename T>
+struct this_tester {
+ void check(void) {
+ value_ = -1;
+
+ BOOST_SCOPE_EXIT_TPL( (this_) ) {
+ BOOST_TEST(this_->value_ == 0);
+ } BOOST_SCOPE_EXIT_END
+
+#ifndef BOOST_NO_LAMBDAS
+ BOOST_SCOPE_EXIT_ALL(&, this) {
+ BOOST_TEST(this->value_ == 0);
+ };
+#endif // lambdas
+
+ value_ = 0;
+ }
+
+private:
+ T value_;
+};
+
+int main(void) {
+ this_tester<int>().check();
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/native_tpl.cpp b/libs/scope_exit/test/native_tpl.cpp
index 58f41f3645..edda6f3e66 100644
--- a/libs/scope_exit/test/native_tpl.cpp
+++ b/libs/scope_exit/test/native_tpl.cpp
@@ -1,87 +1,73 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-#include <iostream>
-#include <ostream>
-#include <vector>
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
#include <boost/scope_exit.hpp>
-
#include <boost/rational.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/typeof/std/vector.hpp>
-#include <boost/test/unit_test.hpp>
-
-using namespace boost::unit_test;
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
template<class type>
-void tpl_long( type tval
- , type& t
- , type const& tc
- , type volatile& tv
- , type const volatile& tcv
- )
-{
+void tpl_long(
+ type tval
+ , type & t
+ , type const& tc
+ , type volatile& tv
+ , type const volatile& tcv
+) {
int i = 0; // non-dependent name
type const remember(tval);
{
- BOOST_SCOPE_EXIT_TPL( (&tval)(&t)(&tc)(&tv)(&tcv)(&i) )
- {
+ BOOST_SCOPE_EXIT_TPL( (&tval) (&t) (&tc) (&tv) (&tcv) (&i) ) {
tval = 1;
++t;
++tv;
- }
- BOOST_SCOPE_EXIT_END
+ } BOOST_SCOPE_EXIT_END
- BOOST_CHECK(t == remember);
- BOOST_CHECK(tval == remember);
+ BOOST_TEST(t == remember);
+ BOOST_TEST(tval == remember);
}
- BOOST_CHECK(tval == 1);
- BOOST_CHECK(t == remember + 2);
+ BOOST_TEST(tval == 1);
+ BOOST_TEST(t == remember + 2);
}
template<class Vector, int Value>
-void tpl_vector( Vector vval
- , Vector& v
- , Vector const& vc
- )
-{
+void tpl_vector(
+ Vector vval
+ , Vector & v
+ , Vector const& vc
+) {
Vector const remember(vval);
{
- BOOST_SCOPE_EXIT_TPL( (&vval)(&v)(&vc) )
- {
+ BOOST_SCOPE_EXIT_TPL( (&vval) (&v) (&vc) ) {
v.push_back(-Value);
vval.push_back(Value);
- }
- BOOST_SCOPE_EXIT_END
+ } BOOST_SCOPE_EXIT_END
- BOOST_CHECK(v.size() == remember.size());
- BOOST_CHECK(vval.size() == remember.size());
+ BOOST_TEST(v.size() == remember.size());
+ BOOST_TEST(vval.size() == remember.size());
}
- BOOST_CHECK(v.size() == 1 + remember.size());
- BOOST_CHECK(vval.size() == 1 + remember.size());
+ BOOST_TEST(v.size() == 1 + remember.size());
+ BOOST_TEST(vval.size() == 1 + remember.size());
}
-void test_tpl()
-{
+int main(void) {
long l = 137;
tpl_long(l, l, l, l, l);
std::vector<int> v(10, 137);
tpl_vector<std::vector<int>, 13>(v, v, v);
-}
-test_suite* init_unit_test_suite( int, char* [] )
-{
- framework::master_test_suite().p_name.value = "Unit test for ScopeExit TPL";
- framework::master_test_suite().add( BOOST_TEST_CASE( &test_tpl ));
- return 0;
+ return boost::report_errors();
}
diff --git a/libs/scope_exit/test/native_tu1.cpp b/libs/scope_exit/test/native_tu1.cpp
index dd03a14ac2..c900154758 100644
--- a/libs/scope_exit/test/native_tu1.cpp
+++ b/libs/scope_exit/test/native_tu1.cpp
@@ -1,13 +1,12 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
#include "tu_test.hpp"
-int tu1()
-{
- return inline_f() + template_f(1);
-}
+int tu1(void) { return inline_f() + template_f(1); }
diff --git a/libs/scope_exit/test/native_tu2.cpp b/libs/scope_exit/test/native_tu2.cpp
index 18b44b41cd..11389327a5 100644
--- a/libs/scope_exit/test/native_tu2.cpp
+++ b/libs/scope_exit/test/native_tu2.cpp
@@ -1,13 +1,12 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
#include "tu_test.hpp"
-int tu2()
-{
- return inline_f() + template_f(2);
-}
+int tu2(void) { return inline_f() + template_f(2); }
diff --git a/libs/scope_exit/test/native_tu_test.cpp b/libs/scope_exit/test/native_tu_test.cpp
index 72ecd474c4..336e951466 100644
--- a/libs/scope_exit/test/native_tu_test.cpp
+++ b/libs/scope_exit/test/native_tu_test.cpp
@@ -1,24 +1,21 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
#include "tu_test.hpp"
+#include <boost/detail/lightweight_test.hpp>
-#include <boost/test/unit_test.hpp>
-
-using namespace boost::unit_test;
-
-void test()
-{
- BOOST_CHECK(tu1() == 1);
- BOOST_CHECK(tu2() == 2);
+void test(void) {
+ BOOST_TEST(tu1() == 1);
+ BOOST_TEST(tu2() == 2);
}
-test_suite* init_unit_test_suite( int, char* [] )
-{
- framework::master_test_suite().p_name.value = "TU unit test for ScopeExit";
- framework::master_test_suite().add( BOOST_TEST_CASE( &test ));
- return 0;
+int main(void) {
+ test();
+ return boost::report_errors();
}
+
diff --git a/libs/scope_exit/test/nova.hpp b/libs/scope_exit/test/nova.hpp
new file mode 100644
index 0000000000..58984acd89
--- /dev/null
+++ b/libs/scope_exit/test/nova.hpp
@@ -0,0 +1,21 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#ifndef NOVA_HPP_
+#define NOVA_HPP_
+
+#include <boost/config.hpp>
+
+// WARNING: This file must be included first in each compilation unit.
+
+// Force no variadic macros but avoiding macro redefinition warning/error.
+#ifndef BOOST_NO_VARIADIC_MACROS
+# define BOOST_NO_VARIADIC_MACROS
+#endif
+
+#endif // #include guard
+
diff --git a/libs/scope_exit/test/same_line.cpp b/libs/scope_exit/test/same_line.cpp
new file mode 100644
index 0000000000..c25277970f
--- /dev/null
+++ b/libs/scope_exit/test/same_line.cpp
@@ -0,0 +1,79 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+//[same_line
+#define SCOPE_EXIT_INC_DEC(variable, offset) \
+ BOOST_SCOPE_EXIT_ID(BOOST_PP_CAT(inc, __LINE__), /* unique ID */ \
+ &variable, offset) { \
+ variable += offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(inc, __LINE__)) \
+ \
+ BOOST_SCOPE_EXIT_ID(BOOST_PP_CAT(dec, __LINE__), \
+ &variable, offset) { \
+ variable -= offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(dec, __LINE__))
+
+#define SCOPE_EXIT_INC_DEC_TPL(variable, offset) \
+ BOOST_SCOPE_EXIT_ID_TPL(BOOST_PP_CAT(inc, __LINE__), \
+ &variable, offset) { \
+ variable += offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(inc, __LINE__)) \
+ \
+ BOOST_SCOPE_EXIT_ID_TPL(BOOST_PP_CAT(dec, __LINE__), \
+ &variable, offset) { \
+ variable -= offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(dec, __LINE__))
+
+#define SCOPE_EXIT_ALL_INC_DEC(variable, offset) \
+ BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(inc, __LINE__), \
+ =, &variable) { \
+ variable += offset; \
+ }; \
+ BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(dec, __LINE__), \
+ =, &variable) { \
+ variable -= offset; \
+ };
+
+template<typename T>
+void f(T& x, T& delta) {
+ SCOPE_EXIT_INC_DEC_TPL(x, delta) // Multiple scope exits on same line.
+ BOOST_TEST(x == 0);
+}
+
+int main(void) {
+ int x = 0, delta = 10;
+
+ {
+ SCOPE_EXIT_INC_DEC(x, delta) // Multiple scope exits on same line.
+ }
+ BOOST_TEST(x == 0);
+
+ f(x, delta);
+
+#ifndef BOOST_NO_LAMBDAS
+ {
+ SCOPE_EXIT_ALL_INC_DEC(x, delta) // Multiple scope exits on same line.
+ }
+ BOOST_TEST(x == 0);
+#endif // LAMBDAS
+
+ return boost::report_errors();
+}
+//]
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/test/same_line_seq.cpp b/libs/scope_exit/test/same_line_seq.cpp
new file mode 100644
index 0000000000..b20a3150c1
--- /dev/null
+++ b/libs/scope_exit/test/same_line_seq.cpp
@@ -0,0 +1,71 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#define SCOPE_EXIT_INC_DEC(variable, offset) \
+ BOOST_SCOPE_EXIT_ID(BOOST_PP_CAT(inc, __LINE__), /* unique ID */ \
+ (&variable) (offset) ) { \
+ variable += offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(inc, __LINE__)) \
+ \
+ BOOST_SCOPE_EXIT_ID(BOOST_PP_CAT(dec, __LINE__), \
+ (&variable) (offset) ) { \
+ variable -= offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(dec, __LINE__))
+
+#define SCOPE_EXIT_INC_DEC_TPL(variable, offset) \
+ BOOST_SCOPE_EXIT_ID_TPL(BOOST_PP_CAT(inc, __LINE__), \
+ (&variable) (offset) ) { \
+ variable += offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(inc, __LINE__)) \
+ \
+ BOOST_SCOPE_EXIT_ID_TPL(BOOST_PP_CAT(dec, __LINE__), \
+ (&variable) (offset) ) { \
+ variable -= offset; \
+ } BOOST_SCOPE_EXIT_END_ID(BOOST_PP_CAT(dec, __LINE__))
+
+#define SCOPE_EXIT_ALL_INC_DEC(variable, offset) \
+ BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(inc, __LINE__), \
+ (=) (&variable) ) { \
+ variable += offset; \
+ }; \
+ BOOST_SCOPE_EXIT_ALL_ID(BOOST_PP_CAT(dec, __LINE__), \
+ (=) (&variable) ) { \
+ variable -= offset; \
+ };
+
+template<typename T>
+void f(T& x, T& delta) {
+ SCOPE_EXIT_INC_DEC_TPL(x, delta)
+ BOOST_TEST(x == 0);
+}
+
+int main(void) {
+ int x = 0, delta = 10;
+
+ {
+ SCOPE_EXIT_INC_DEC(x, delta)
+ }
+ BOOST_TEST(x == 0);
+
+ f(x, delta);
+
+#ifndef BOOST_NO_LAMBDAS
+ {
+ SCOPE_EXIT_ALL_INC_DEC(x, delta)
+ }
+ BOOST_TEST(x == 0);
+#endif // LAMBDAS
+
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/same_line_seq_nova.cpp b/libs/scope_exit/test/same_line_seq_nova.cpp
new file mode 100644
index 0000000000..ca45697bcd
--- /dev/null
+++ b/libs/scope_exit/test/same_line_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "same_line_seq.cpp"
+
diff --git a/libs/scope_exit/test/tu_test.hpp b/libs/scope_exit/test/tu_test.hpp
index a0d50f75f2..25b9a1c6a7 100644
--- a/libs/scope_exit/test/tu_test.hpp
+++ b/libs/scope_exit/test/tu_test.hpp
@@ -1,39 +1,46 @@
-// Copyright Alexander Nasonov 2007-2008
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+// No #include guard for this header.
#include <boost/scope_exit.hpp>
+#include <boost/config.hpp>
-int tu1();
-int tu2();
+int tu1(void);
+int tu2(void);
-inline int inline_f()
-{
+inline int inline_f(void) {
int i = 99;
{
- BOOST_SCOPE_EXIT( (&i) ) { i = -1; } BOOST_SCOPE_EXIT_END
+ BOOST_SCOPE_EXIT( (&i) ) {
+ i = -1;
+ } BOOST_SCOPE_EXIT_END
}
return i;
}
-#if !defined(BOOST_SCOPE_EXIT_AUX_GCC)
-#error "BOOST_SCOPE_EXIT_AUX_GCC undefined!"
-#elif BOOST_SCOPE_EXIT_AUX_GCC == 0 || BOOST_SCOPE_EXIT_AUX_GCC >= 304
+#if !defined(BOOST_INTEL) && defined(__GNUC__) && \
+ (__GNUC__ * 100 + __GNUC_MINOR__) >= 304
template<class Int>
-Int template_f(Int i)
-{
+Int template_f(Int i) {
{
- BOOST_SCOPE_EXIT_TPL( (&i) ) { ++i; } BOOST_SCOPE_EXIT_END
+ BOOST_SCOPE_EXIT_TPL( (&i) ) {
+ ++i;
+ } BOOST_SCOPE_EXIT_END
}
return i;
}
#else
-inline int template_f(int i)
-{
+inline int template_f(int i) {
{
- BOOST_SCOPE_EXIT( (&i) ) { ++i; } BOOST_SCOPE_EXIT_END
+ BOOST_SCOPE_EXIT( (&i) ) {
+ ++i;
+ } BOOST_SCOPE_EXIT_END
}
return i;
}
diff --git a/libs/scope_exit/test/world.cpp b/libs/scope_exit/test/world.cpp
new file mode 100644
index 0000000000..721475655c
--- /dev/null
+++ b/libs/scope_exit/test/world.cpp
@@ -0,0 +1,58 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+
+struct person {};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ void add_person(person const& a_person);
+ size_t population(void) const { return persons_.size(); }
+
+private:
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+//[world
+void world::add_person(person const& a_person) {
+ bool commit = false;
+
+ persons_.push_back(a_person); // (1) direct action
+ // Following block is executed when the enclosing scope exits.
+ BOOST_SCOPE_EXIT(&commit, &persons_) {
+ if(!commit) persons_.pop_back(); // (2) rollback action
+ } BOOST_SCOPE_EXIT_END
+
+ // ... // (3) other operations
+
+ commit = true; // (4) disable rollback actions
+}
+//]
+
+int main(void) {
+ world w;
+ person p;
+ w.add_person(p);
+ BOOST_TEST(w.population() == 1);
+ return boost::report_errors();
+}
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/test/world_checkpoint.cpp b/libs/scope_exit/test/world_checkpoint.cpp
new file mode 100644
index 0000000000..ce8bd5d874
--- /dev/null
+++ b/libs/scope_exit/test/world_checkpoint.cpp
@@ -0,0 +1,112 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/foreach.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+#include <iostream>
+#include <sstream>
+
+struct person {
+ typedef unsigned int id_t;
+ typedef unsigned int evolution_t;
+
+ id_t id;
+ evolution_t evolution;
+
+ person(void) : id(0), evolution(0) {}
+
+ friend std::ostream& operator<<(std::ostream& o, person const& p) {
+ return o << "person(" << p.id << ", " << p.evolution << ")";
+ }
+};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ world(void) : next_id_(1) {}
+ void add_person(person const& a_person);
+
+ friend std::ostream& operator<<(std::ostream& o, world const& w) {
+ o << "world(" << w.next_id_ << ", {";
+ BOOST_FOREACH(person const& p, w.persons_) {
+ o << " " << p << ", ";
+ }
+ return o << "})";
+ }
+
+private:
+ person::id_t next_id_;
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+//[world_checkpoint
+void world::add_person(person const& a_person) {
+ persons_.push_back(a_person);
+
+ // This block must be no-throw.
+ person& p = persons_.back();
+ person::evolution_t checkpoint = p.evolution;
+ BOOST_SCOPE_EXIT(checkpoint, &p, &persons_) {
+ if(checkpoint == p.evolution) persons_.pop_back();
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ checkpoint = ++p.evolution;
+
+ // Assign new identifier to the person.
+ person::id_t const prev_id = p.id;
+ p.id = next_id_++;
+ BOOST_SCOPE_EXIT(checkpoint, &p, &next_id_, prev_id) {
+ if(checkpoint == p.evolution) {
+ next_id_ = p.id;
+ p.id = prev_id;
+ }
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ checkpoint = ++p.evolution;
+}
+//]
+
+int main(void) {
+ person adam, eva;
+ std::ostringstream oss;
+ oss << adam;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ oss.str("");
+ oss << eva;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ world w;
+ w.add_person(adam);
+ w.add_person(eva);
+ oss.str("");
+ oss << w;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
+
+ return boost::report_errors();
+}
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/test/world_checkpoint_all.cpp b/libs/scope_exit/test/world_checkpoint_all.cpp
new file mode 100644
index 0000000000..051b34cfdf
--- /dev/null
+++ b/libs/scope_exit/test/world_checkpoint_all.cpp
@@ -0,0 +1,116 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#if defined(BOOST_NO_LAMBDAS)
+# error "lambda functions required"
+#elif defined(BOOST_NO_VARIADIC_MACROS)
+# error "variadic macros required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/foreach.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+#include <iostream>
+#include <sstream>
+
+struct person {
+ typedef unsigned int id_t;
+ typedef unsigned int evolution_t;
+
+ id_t id;
+ evolution_t evolution;
+
+ person(void) : id(0), evolution(0) {}
+
+ friend std::ostream& operator<<(std::ostream& o, person const& p) {
+ return o << "person(" << p.id << ", " << p.evolution << ")";
+ }
+};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ world(void) : next_id_(1) {}
+ void add_person(person const& a_person);
+
+ friend std::ostream& operator<<(std::ostream& o, world const& w) {
+ o << "world(" << w.next_id_ << ", {";
+ BOOST_FOREACH(person const& p, w.persons_) {
+ o << " " << p << ", ";
+ }
+ return o << "})";
+ }
+
+private:
+ person::id_t next_id_;
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+//[world_checkpoint_all
+void world::add_person(person const& a_person) {
+ persons_.push_back(a_person);
+
+ // This block must be no-throw.
+ person& p = persons_.back();
+ person::evolution_t checkpoint = p.evolution;
+ // Capture all by reference `&`, but `checkpoint` and `this` (C++11 only).
+ BOOST_SCOPE_EXIT_ALL(&, checkpoint, this) { // Use `this` (not `this_`).
+ if(checkpoint == p.evolution) this->persons_.pop_back();
+ }; // Use `;` (not `SCOPE_EXIT_END`).
+
+ // ...
+
+ checkpoint = ++p.evolution;
+
+ // Assign new identifier to the person.
+ person::id_t const prev_id = p.id;
+ p.id = next_id_++;
+ // Capture all by value `=`, but `p` (C++11 only).
+ BOOST_SCOPE_EXIT_ALL(=, &p) {
+ if(checkpoint == p.evolution) {
+ this->next_id_ = p.id;
+ p.id = prev_id;
+ }
+ };
+
+ // ...
+
+ checkpoint = ++p.evolution;
+}
+//]
+
+int main(void) {
+ person adam, eva;
+ std::ostringstream oss;
+ oss << adam;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ oss.str("");
+ oss << eva;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ world w;
+ w.add_person(adam);
+ w.add_person(eva);
+ oss.str("");
+ oss << w;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
+
+ return boost::report_errors();
+}
+
+#endif // lambda functions and variadic macros
+
diff --git a/libs/scope_exit/test/world_checkpoint_all_seq.cpp b/libs/scope_exit/test/world_checkpoint_all_seq.cpp
new file mode 100644
index 0000000000..eac120480b
--- /dev/null
+++ b/libs/scope_exit/test/world_checkpoint_all_seq.cpp
@@ -0,0 +1,110 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/foreach.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+#include <iostream>
+#include <sstream>
+
+struct person {
+ typedef unsigned int id_t;
+ typedef unsigned int evolution_t;
+
+ id_t id;
+ evolution_t evolution;
+
+ person(void) : id(0), evolution(0) {}
+
+ friend std::ostream& operator<<(std::ostream& o, person const& p) {
+ return o << "person(" << p.id << ", " << p.evolution << ")";
+ }
+};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ world(void) : next_id_(1) {}
+ void add_person(person const& a_person);
+
+ friend std::ostream& operator<<(std::ostream& o, world const& w) {
+ o << "world(" << w.next_id_ << ", {";
+ BOOST_FOREACH(person const& p, w.persons_) {
+ o << " " << p << ", ";
+ }
+ return o << "})";
+ }
+
+private:
+ person::id_t next_id_;
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+void world::add_person(person const& a_person) {
+ persons_.push_back(a_person);
+
+ // This block must be no-throw.
+ person& p = persons_.back();
+ person::evolution_t checkpoint = p.evolution;
+ BOOST_SCOPE_EXIT_ALL( (&) (checkpoint) (this) ) {
+ if(checkpoint == p.evolution) this->persons_.pop_back();
+ };
+
+ // ...
+
+ checkpoint = ++p.evolution;
+
+ // Assign new identifier to the person.
+ person::id_t const prev_id = p.id;
+ p.id = next_id_++;
+ BOOST_SCOPE_EXIT_ALL( (=) (&p) ) {
+ if(checkpoint == p.evolution) {
+ this->next_id_ = p.id;
+ p.id = prev_id;
+ }
+ };
+
+ // ...
+
+ checkpoint = ++p.evolution;
+}
+
+int main(void) {
+ person adam, eva;
+ std::ostringstream oss;
+ oss << adam;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ oss.str("");
+ oss << eva;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ world w;
+ w.add_person(adam);
+ w.add_person(eva);
+ oss.str("");
+ oss << w;
+ std::cout << oss.str() << std::endl;
+ BOOST_TEST(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
+
+ return boost::report_errors();
+}
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/test/world_checkpoint_all_seq_nova.cpp b/libs/scope_exit/test/world_checkpoint_all_seq_nova.cpp
new file mode 100644
index 0000000000..b1be0744ff
--- /dev/null
+++ b/libs/scope_exit/test/world_checkpoint_all_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_checkpoint_all_seq.cpp"
+
diff --git a/libs/scope_exit/test/world_checkpoint_seq.cpp b/libs/scope_exit/test/world_checkpoint_seq.cpp
new file mode 100644
index 0000000000..1537036e08
--- /dev/null
+++ b/libs/scope_exit/test/world_checkpoint_seq.cpp
@@ -0,0 +1,99 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/foreach.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+#include <sstream>
+
+struct person {
+ typedef unsigned int id_t;
+ typedef unsigned int evolution_t;
+
+ id_t id;
+ evolution_t evolution;
+
+ person(void) : id(0), evolution(0) {}
+
+ friend std::ostream& operator<<(std::ostream& o, person const& p) {
+ return o << "person(" << p.id << ", " << p.evolution << ")";
+ }
+};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ world(void) : next_id_(1) {}
+ void add_person(person const& a_person);
+
+ friend std::ostream& operator<<(std::ostream& o, world const& w) {
+ o << "world(" << w.next_id_ << ", {";
+ BOOST_FOREACH(person const& p, w.persons_) {
+ o << " " << p << ", ";
+ }
+ return o << "})";
+ }
+
+private:
+ person::id_t next_id_;
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+void world::add_person(person const& a_person) {
+ persons_.push_back(a_person);
+
+ // This block must be no-throw.
+ person& p = persons_.back();
+ person::evolution_t checkpoint = p.evolution;
+ BOOST_SCOPE_EXIT( (checkpoint) (&p) (&persons_) ) {
+ if(checkpoint == p.evolution) persons_.pop_back();
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ checkpoint = ++p.evolution;
+
+ // Assign new identifier to the person.
+ person::id_t const prev_id = p.id;
+ p.id = next_id_++;
+ BOOST_SCOPE_EXIT( (checkpoint) (&p) (&next_id_) (prev_id) ) {
+ if(checkpoint == p.evolution) {
+ next_id_ = p.id;
+ p.id = prev_id;
+ }
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ checkpoint = ++p.evolution;
+}
+
+int main(void) {
+ person adam, eva;
+ std::ostringstream oss;
+ oss << adam;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ oss.str("");
+ oss << eva;
+ BOOST_TEST(oss.str() == "person(0, 0)");
+
+ world w;
+ w.add_person(adam);
+ w.add_person(eva);
+ oss.str("");
+ oss << w;
+ BOOST_TEST(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
+
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/world_checkpoint_seq_nova.cpp b/libs/scope_exit/test/world_checkpoint_seq_nova.cpp
new file mode 100644
index 0000000000..dc6f991a83
--- /dev/null
+++ b/libs/scope_exit/test/world_checkpoint_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_checkpoint_seq.cpp"
+
diff --git a/libs/scope_exit/test/world_seq.cpp b/libs/scope_exit/test/world_seq.cpp
new file mode 100644
index 0000000000..0a7299eef5
--- /dev/null
+++ b/libs/scope_exit/test/world_seq.cpp
@@ -0,0 +1,51 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+
+struct person {};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ void add_person(person const& a_person);
+ size_t population(void) const { return persons_.size(); }
+
+private:
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+//[world_seq
+void world::add_person(person const& a_person) {
+ bool commit = false;
+
+ persons_.push_back(a_person); // (1) direct action
+ // Following block is executed when the enclosing scope exits.
+ BOOST_SCOPE_EXIT( (&commit) (&persons_) ) {
+ if(!commit) persons_.pop_back(); // (2) rollback action
+ } BOOST_SCOPE_EXIT_END
+
+ // ... // (3) other operations
+
+ commit = true; // (4) disable rollback actions
+}
+//]
+
+int main(void) {
+ world w;
+ person p;
+ w.add_person(p);
+ BOOST_TEST(w.population() == 1);
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/world_seq_nova.cpp b/libs/scope_exit/test/world_seq_nova.cpp
new file mode 100644
index 0000000000..8809f1ccec
--- /dev/null
+++ b/libs/scope_exit/test/world_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_seq.cpp"
+
diff --git a/libs/scope_exit/test/world_this.cpp b/libs/scope_exit/test/world_this.cpp
new file mode 100644
index 0000000000..3838d969ed
--- /dev/null
+++ b/libs/scope_exit/test/world_this.cpp
@@ -0,0 +1,58 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/config.hpp>
+#include <vector>
+
+struct person {};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ void add_person(person const& a_person);
+ size_t population(void) const { return persons_.size(); }
+
+private:
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+void world::add_person(person const& a_person) {
+ bool commit = false;
+
+ persons_.push_back(a_person);
+ //[world_this
+ BOOST_SCOPE_EXIT(&commit, this_) { // Capture object `this_`.
+ if(!commit) this_->persons_.pop_back();
+ } BOOST_SCOPE_EXIT_END
+ //]
+
+ // ...
+
+ commit = true;
+}
+
+int main(void) {
+ world w;
+ person p;
+ w.add_person(p);
+ BOOST_TEST(w.population() == 1);
+ return boost::report_errors();
+}
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/test/world_this_seq.cpp b/libs/scope_exit/test/world_this_seq.cpp
new file mode 100644
index 0000000000..6d7b7cb08c
--- /dev/null
+++ b/libs/scope_exit/test/world_this_seq.cpp
@@ -0,0 +1,49 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/config.hpp>
+#include <vector>
+
+struct person {};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world {
+ void add_person(person const& a_person);
+ size_t population(void) const { return persons_.size(); }
+
+private:
+ std::vector<person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TYPE(world)
+
+void world::add_person(person const& a_person) {
+ bool commit = false;
+
+ persons_.push_back(a_person);
+ BOOST_SCOPE_EXIT( (&commit) (this_) ) {
+ if(!commit) this_->persons_.pop_back();
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ commit = true;
+}
+
+int main(void) {
+ world w;
+ person p;
+ w.add_person(p);
+ BOOST_TEST(w.population() == 1);
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/world_this_seq_nova.cpp b/libs/scope_exit/test/world_this_seq_nova.cpp
new file mode 100644
index 0000000000..5fe0bf5186
--- /dev/null
+++ b/libs/scope_exit/test/world_this_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_this_seq.cpp"
+
diff --git a/libs/scope_exit/test/world_tpl.cpp b/libs/scope_exit/test/world_tpl.cpp
new file mode 100644
index 0000000000..47d0571abe
--- /dev/null
+++ b/libs/scope_exit/test/world_tpl.cpp
@@ -0,0 +1,59 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macro required"
+#else
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+
+struct person {};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+template<typename Person>
+struct world {
+ void add_person(Person const& a_person);
+ size_t population(void) const { return persons_.size(); }
+
+private:
+ std::vector<Person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TEMPLATE(world, 1)
+
+//[world_tpl
+template<typename Person>
+void world<Person>::add_person(Person const& a_person) {
+ bool commit = false;
+ persons_.push_back(a_person);
+
+ BOOST_SCOPE_EXIT_TPL(&commit, this_) { // Use `_TPL` postfix.
+ if(!commit) this_->persons_.pop_back();
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ commit = true;
+}
+//]
+
+int main(void) {
+ world<person> w;
+ person p;
+ w.add_person(p);
+ BOOST_TEST(w.population() == 1);
+ return boost::report_errors();
+}
+
+#endif // variadic macros
+
diff --git a/libs/scope_exit/test/world_tpl_seq.cpp b/libs/scope_exit/test/world_tpl_seq.cpp
new file mode 100644
index 0000000000..9a890d64aa
--- /dev/null
+++ b/libs/scope_exit/test/world_tpl_seq.cpp
@@ -0,0 +1,50 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+
+struct person {};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+template<typename Person>
+struct world {
+ void add_person(Person const& a_person);
+ size_t population(void) const { return persons_.size(); }
+
+private:
+ std::vector<Person> persons_;
+};
+BOOST_TYPEOF_REGISTER_TEMPLATE(world, 1)
+
+template<typename Person>
+void world<Person>::add_person(Person const& a_person) {
+ bool commit = false;
+ persons_.push_back(a_person);
+
+ BOOST_SCOPE_EXIT_TPL( (&commit) (this_) ) {
+ if(!commit) this_->persons_.pop_back();
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ commit = true;
+}
+
+int main(void) {
+ world<person> w;
+ person p;
+ w.add_person(p);
+ BOOST_TEST(w.population() == 1);
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/world_tpl_seq_nova.cpp b/libs/scope_exit/test/world_tpl_seq_nova.cpp
new file mode 100644
index 0000000000..f25c2d554d
--- /dev/null
+++ b/libs/scope_exit/test/world_tpl_seq_nova.cpp
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_tpl_seq.cpp"
+
diff --git a/libs/scope_exit/test/world_void.cpp b/libs/scope_exit/test/world_void.cpp
new file mode 100644
index 0000000000..04cf185179
--- /dev/null
+++ b/libs/scope_exit/test/world_void.cpp
@@ -0,0 +1,48 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/scope_exit.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/typeof/std/vector.hpp>
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#include <boost/detail/lightweight_test.hpp>
+#include <vector>
+
+struct person {};
+BOOST_TYPEOF_REGISTER_TYPE(person)
+
+struct world_t;
+BOOST_TYPEOF_REGISTER_TYPE(world_t)
+
+//[world_void
+struct world_t {
+ std::vector<person> persons;
+ bool commit;
+} world; // Global variable.
+
+void add_person(person const& a_person) {
+ world.commit = false;
+ world.persons.push_back(a_person);
+
+ BOOST_SCOPE_EXIT(void) { // No captures.
+ if(!world.commit) world.persons.pop_back();
+ } BOOST_SCOPE_EXIT_END
+
+ // ...
+
+ world.commit = true;
+}
+//]
+
+int main(void) {
+ person p;
+ add_person(p);
+ BOOST_TEST(world.persons.size() == 1);
+ return boost::report_errors();
+}
+
diff --git a/libs/scope_exit/test/world_void_nova.cpp b/libs/scope_exit/test/world_void_nova.cpp
new file mode 100644
index 0000000000..777067f862
--- /dev/null
+++ b/libs/scope_exit/test/world_void_nova.cpp
@@ -0,0 +1,11 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_void.cpp"
+