1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Class specify_except</title> 5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0.0"> 8<link rel="up" href="../../reference.html#header.boost.contract.core.specify_hpp" title="Header <boost/contract/core/specify.hpp>"> 9<link rel="prev" href="set_invariant_failure.html" title="Function set_invariant_failure"> 10<link rel="next" href="specify_nothing.html" title="Class specify_nothing"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="set_invariant_failure.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.specify_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="specify_nothing.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="refentry"> 26<a name="boost.contract.specify_except"></a><div class="titlepage"></div> 27<div class="refnamediv"> 28<h2><span class="refentrytitle">Class specify_except</span></h2> 29<p>boost::contract::specify_except — Allow to specify exception guarantees. </p> 30</div> 31<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> 32<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../reference.html#header.boost.contract.core.specify_hpp" title="Header <boost/contract/core/specify.hpp>">boost/contract/core/specify.hpp</a>> 33 34</span> 35<span class="keyword">class</span> <a class="link" href="specify_except.html" title="Class specify_except">specify_except</a> <span class="special">{</span> 36<span class="keyword">public</span><span class="special">:</span> 37 <span class="comment">// <a class="link" href="specify_except.html#boost.contract.specify_exceptconstruct-copy-destruct">construct/copy/destruct</a></span> 38 <a class="link" href="specify_except.html#idm46268585069280-bb"><span class="special">~</span><span class="identifier">specify_except</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span> 39 40 <span class="comment">// <a class="link" href="specify_except.html#idm46268585076848-bb">public member functions</a></span> 41 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span> <a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <a class="link" href="specify_except.html#idm46268585076288-bb"><span class="identifier">except</span></a><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span> 42<span class="special">}</span><span class="special">;</span></pre></div> 43<div class="refsect1"> 44<a name="idm45988678347072"></a><h2>Description</h2> 45<p>Allow to specify the functor this library will call to check exception guarantees. This object is internally constructed by the library when users specify contracts calling <code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code> and similar functions (that is why this class does not have a public constructor).</p> 46<p><span class="bold"><strong>See Also:</strong></span></p> 47<p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.exception_guarantees" title="Exception Guarantees"> Exception Guarantees</a> </p> 48<p> 49</p> 50<p> 51</p> 52<div class="refsect2"> 53<a name="idm45988678342736"></a><h3> 54<a name="boost.contract.specify_exceptconstruct-copy-destruct"></a><code class="computeroutput">specify_except</code> 55 public 56 construct/copy/destruct</h3> 57<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"> 58<pre class="literallayout"><a name="idm46268585069280-bb"></a><span class="special">~</span><span class="identifier">specify_except</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destruct this object. <p><span class="bold"><strong>Throws:</strong></span> This is declared <code class="computeroutput">noexcept(false)</code> since C++11 to allow users to program failure handlers that throw exceptions on contract assertion failures (not the default, see <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)"> 59 Throw on Failure</a>). </p> 60</li></ol></div> 61</div> 62<div class="refsect2"> 63<a name="idm45988678333504"></a><h3> 64<a name="idm46268585076848-bb"></a><code class="computeroutput">specify_except</code> public member functions</h3> 65<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"> 66<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> F<span class="special">></span> <a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <a name="idm46268585076288-bb"></a><span class="identifier">except</span><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span><span class="special">;</span></pre>Allow to specify exception guarantees. <p> 67 68</p> 69<div class="variablelist"><table border="0" class="variablelist compact"> 70<colgroup> 71<col align="left" valign="top"> 72<col> 73</colgroup> 74<tbody> 75<tr> 76<td><p><span class="term">Parameters:</span></p></td> 77<td><div class="variablelist"><table border="0" class="variablelist compact"> 78<colgroup> 79<col align="left" valign="top"> 80<col> 81</colgroup> 82<tbody><tr> 83<td><p><span class="term"><code class="computeroutput">f</code></span></p></td> 84<td><p>Nullary functor called by this library to check exception guarantees <code class="computeroutput">f()</code>. Assertions within this functor are usually programmed using <code class="computeroutput"><code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_ASSERT.html" title="Macro BOOST_CONTRACT_ASSERT">BOOST_CONTRACT_ASSERT</a></code></code>, but any exception thrown by a call to this functor indicates a contract assertion failure (and will result in this library calling <code class="computeroutput"><code class="computeroutput"><a class="link" href="except_failure.html" title="Function except_failure">boost::contract::except_failure</a></code></code>). This functor should capture variables by (constant) references (to access the values they will have at function exit).</p></td> 85</tr></tbody> 86</table></div></td> 87</tr> 88<tr> 89<td><p><span class="term">Returns:</span></p></td> 90<td><p>After exception guarantees have been specified, the object returned by this function does not allow to specify any additional contract. </p></td> 91</tr> 92</tbody> 93</table></div> 94</li></ol></div> 95</div> 96</div> 97</div> 98<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 99<td align="left"></td> 100<td align="right"><div class="copyright-footer">Copyright © 2008-2019 Lorenzo Caminiti<p> 101 Distributed under the Boost Software License, Version 1.0 (see accompanying 102 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>) 103 </p> 104</div></td> 105</tr></table> 106<hr> 107<div class="spirit-nav"> 108<a accesskey="p" href="set_invariant_failure.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.core.specify_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="specify_nothing.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 109</div> 110</body> 111</html> 112