Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / contract / doc / html / boost / contract / specify__idm45394999207792.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class template specify_postcondition_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&#160;1.&#160;Boost.Contract 1.0.0">
8 <link rel="up" href="../../reference.html#header.boost.contract.core.specify_hpp" title="Header &lt;boost/contract/core/specify.hpp&gt;">
9 <link rel="prev" href="specify__idm45394999245856.html" title="Class template specify_old_postcondition_except">
10 <link rel="next" href="specify__idm45394999179040.html" title="Class template specify_precondition_old_postcondition_except">
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="specify__idm45394999245856.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__idm45394999179040.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="refentry">
26 <a name="boost.contract.specify__idm45394999207792"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Class template specify_postcondition_except</span></h2>
29 <p>boost::contract::specify_postcondition_except &#8212; Allow to specify postconditions or 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: &lt;<a class="link" href="../../reference.html#header.boost.contract.core.specify_hpp" title="Header &lt;boost/contract/core/specify.hpp&gt;">boost/contract/core/specify.hpp</a>&gt;
33
34 </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> VirtualResult <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span> 
35 <span class="keyword">class</span> <a class="link" href="specify__idm45394999207792.html" title="Class template specify_postcondition_except">specify_postcondition_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__idm45394999207792.html#boost.contract.specify__idm45394999207792construct-copy-destruct">construct/copy/destruct</a></span>
38   <a class="link" href="specify__idm45394999207792.html#idm45394999181936-bb"><span class="special">~</span><span class="identifier">specify_postcondition_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__idm45394999207792.html#idm45394999200512-bb">public member functions</a></span>
41   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> <a class="link" href="specify_except.html" title="Class specify_except">specify_except</a> <a class="link" href="specify__idm45394999207792.html#idm45394999199952-bb"><span class="identifier">postcondition</span></a><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
42   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> <a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <a class="link" href="specify__idm45394999207792.html#idm45394999188944-bb"><span class="identifier">except</span></a><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
43 <span class="special">}</span><span class="special">;</span></pre></div>
44 <div class="refsect1">
45 <a name="idm45707995326512"></a><h2>Description</h2>
46 <p>Allow to specify functors this library will call to check postconditions or 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>
47 <p><span class="bold"><strong>See Also:</strong></span></p>
48 <p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.postconditions" title="Postconditions"> Postconditions</a>,  <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.exception_guarantees" title="Exception Guarantees"> Exception Guarantees</a></p>
49 <p>
50 </p>
51 <p>
52
53 </p>
54 <div class="refsect2">
55 <a name="idm45707995321456"></a><h3>Template Parameters</h3>
56 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
57 <pre class="literallayout"><span class="keyword">typename</span> VirtualResult <span class="special">=</span> <span class="keyword">void</span></pre>
58 <p>Return type of the enclosing function declaring the contract if that is either a virtual or an overriding public function, otherwise this is always <code class="computeroutput">void</code>. (Usually this template parameter is automatically deduced by C++ and it does not need to be explicitly specified by programmers.) </p>
59 </li></ol></div>
60 </div>
61 <div class="refsect2">
62 <a name="idm45707995316128"></a><h3>
63 <a name="boost.contract.specify__idm45394999207792construct-copy-destruct"></a><code class="computeroutput">specify_postcondition_except</code> 
64         public
65        construct/copy/destruct</h3>
66 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
67 <pre class="literallayout"><a name="idm45394999181936-bb"></a><span class="special">~</span><span class="identifier">specify_postcondition_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)">
68             Throw on Failure</a>). </p>
69 </li></ol></div>
70 </div>
71 <div class="refsect2">
72 <a name="idm45707995306912"></a><h3>
73 <a name="idm45394999200512-bb"></a><code class="computeroutput">specify_postcondition_except</code> public member functions</h3>
74 <div class="orderedlist"><ol class="orderedlist" type="1">
75 <li class="listitem">
76 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> <a class="link" href="specify_except.html" title="Class specify_except">specify_except</a> <a name="idm45394999199952-bb"></a><span class="identifier">postcondition</span><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span><span class="special">;</span></pre>Allow to specify postconditions. <p>
77
78 </p>
79 <div class="variablelist"><table border="0" class="variablelist compact">
80 <colgroup>
81 <col align="left" valign="top">
82 <col>
83 </colgroup>
84 <tbody>
85 <tr>
86 <td><p><span class="term">Parameters:</span></p></td>
87 <td><div class="variablelist"><table border="0" class="variablelist compact">
88 <colgroup>
89 <col align="left" valign="top">
90 <col>
91 </colgroup>
92 <tbody><tr>
93 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
94 <td><p>Functor called by this library to check postconditions <code class="computeroutput">f()</code> or <code class="computeroutput">f(result)</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="postcondition_failure.html" title="Function postcondition_failure">boost::contract::postcondition_failure</a></code></code>). This functor should capture variables by (constant) references (to access the values they will have at function exit). This functor must be a nullary functor <code class="computeroutput">f()</code> if <code class="computeroutput">VirtualResult</code> is <code class="computeroutput">void</code>, otherwise it must be a unary functor <code class="computeroutput">f(result)</code> accepting the return value <code class="computeroutput">result</code> as a parameter of type <code class="computeroutput">VirtualResult const&amp;</code> (to avoid extra copies of the return value, or of type <code class="computeroutput">VirtualResult</code> or <code class="computeroutput">VirtualResult const</code> if extra copies of the return value are irrelevant).</p></td>
95 </tr></tbody>
96 </table></div></td>
97 </tr>
98 <tr>
99 <td><p><span class="term">Returns:</span></p></td>
100 <td><p>After postconditions have been specified, the object returned by this function allows to optionally specify exception guarantees. </p></td>
101 </tr>
102 </tbody>
103 </table></div>
104 </li>
105 <li class="listitem">
106 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> <a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <a name="idm45394999188944-bb"></a><span class="identifier">except</span><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span><span class="special">;</span></pre>Allow to specify exception guarantees. <p>
107
108 </p>
109 <div class="variablelist"><table border="0" class="variablelist compact">
110 <colgroup>
111 <col align="left" valign="top">
112 <col>
113 </colgroup>
114 <tbody>
115 <tr>
116 <td><p><span class="term">Parameters:</span></p></td>
117 <td><div class="variablelist"><table border="0" class="variablelist compact">
118 <colgroup>
119 <col align="left" valign="top">
120 <col>
121 </colgroup>
122 <tbody><tr>
123 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
124 <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>
125 </tr></tbody>
126 </table></div></td>
127 </tr>
128 <tr>
129 <td><p><span class="term">Returns:</span></p></td>
130 <td><p>After exception guarantees have been specified, the object returned by this function does not allow to specify any additional contract. </p></td>
131 </tr>
132 </tbody>
133 </table></div>
134 </li>
135 </ol></div>
136 </div>
137 </div>
138 </div>
139 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
140 <td align="left"></td>
141 <td align="right"><div class="copyright-footer">Copyright &#169; 2008-2019 Lorenzo Caminiti<p>
142         Distributed under the Boost Software License, Version 1.0 (see accompanying
143         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>)
144       </p>
145 </div></td>
146 </tr></table>
147 <hr>
148 <div class="spirit-nav">
149 <a accesskey="p" href="specify__idm45394999245856.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__idm45394999179040.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
150 </div>
151 </body>
152 </html>