Imported Upstream version 1.71.0
[platform/upstream/boost.git] / libs / contract / doc / html / boost / contract / specify__idm45123870039968.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class template specify_precondition_old_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__idm45123870066880.html" title="Class template specify_postcondition_except">
10 <link rel="next" href="virtual_.html" title="Class virtual_">
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__idm45123870066880.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="virtual_.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="refentry">
26 <a name="boost.contract.specify__idm45123870039968"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Class template specify_precondition_old_postcondition_except</span></h2>
29 <p>boost::contract::specify_precondition_old_postcondition_except &#8212; Allow to specify preconditions, old value copies at body, postconditions, and 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__idm45123870039968.html" title="Class template specify_precondition_old_postcondition_except">specify_precondition_old_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__idm45123870039968.html#boost.contract.specify__idm45123870039968construct-copy-destruct">construct/copy/destruct</a></span>
38   <a class="link" href="specify__idm45123870039968.html#idm45123869998800-bb"><span class="special">~</span><span class="identifier">specify_precondition_old_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__idm45123870039968.html#idm45123870031168-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> 
42     <a class="link" href="specify__idm45123870103104.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <a class="link" href="specify__idm45123870039968.html#idm45123870030608-bb"><span class="identifier">precondition</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="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> 
44     <a class="link" href="specify__idm45123870066880.html" title="Class template specify_postcondition_except">specify_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <a class="link" href="specify__idm45123870039968.html#idm45123870023552-bb"><span class="identifier">old</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>
45   <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__idm45123870039968.html#idm45123870015056-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>
46   <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__idm45123870039968.html#idm45123870005808-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>
47 <span class="special">}</span><span class="special">;</span></pre></div>
48 <div class="refsect1">
49 <a name="idm45751728676240"></a><h2>Description</h2>
50 <p>Allow to specify functors this library will call to check preconditions, copy old values at body, check postconditions, and check exception guarantees. This object is internally constructed by this 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>
51 <p><span class="bold"><strong>See Also:</strong></span></p>
52 <p> <a class="link" href="../../boost_contract/tutorial.html#boost_contract.tutorial.preconditions" title="Preconditions"> Preconditions</a>,  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.old_value_copies_at_body" title="Old Value Copies at Body"> Old Value Copies at Body</a>,  <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>
53 <p>
54 </p>
55 <p>
56
57 </p>
58 <div class="refsect2">
59 <a name="idm45751728669328"></a><h3>Template Parameters</h3>
60 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
61 <pre class="literallayout"><span class="keyword">typename</span> VirtualResult <span class="special">=</span> <span class="keyword">void</span></pre>
62 <p>Return type of the enclosing function declaring the contract if that function is either a virtual public function or a public function override. Otherwise, this type is always <code class="computeroutput">void</code>. </p>
63 </li></ol></div>
64 </div>
65 <div class="refsect2">
66 <a name="idm45751728664112"></a><h3>
67 <a name="boost.contract.specify__idm45123870039968construct-copy-destruct"></a><code class="computeroutput">specify_precondition_old_postcondition_except</code> 
68         public
69        construct/copy/destruct</h3>
70 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
71 <pre class="literallayout"><a name="idm45123869998800-bb"></a><span class="special">~</span><span class="identifier">specify_precondition_old_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 can throw in case programmers specify failure handlers that throw exceptions instead of terminating the program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
72             Throw on Failure</a>). (This is declared <code class="computeroutput">noexcept(false)</code> since C++11.) </p>
73 </li></ol></div>
74 </div>
75 <div class="refsect2">
76 <a name="idm45751728654816"></a><h3>
77 <a name="idm45123870031168-bb"></a><code class="computeroutput">specify_precondition_old_postcondition_except</code> public member functions</h3>
78 <div class="orderedlist"><ol class="orderedlist" type="1">
79 <li class="listitem">
80 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> 
81   <a class="link" href="specify__idm45123870103104.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <a name="idm45123870030608-bb"></a><span class="identifier">precondition</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 preconditions. <p>
82
83 </p>
84 <div class="variablelist"><table border="0" class="variablelist compact">
85 <colgroup>
86 <col align="left" valign="top">
87 <col>
88 </colgroup>
89 <tbody>
90 <tr>
91 <td><p><span class="term">Parameters:</span></p></td>
92 <td><div class="variablelist"><table border="0" class="variablelist compact">
93 <colgroup>
94 <col align="left" valign="top">
95 <col>
96 </colgroup>
97 <tbody><tr>
98 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
99 <td><p>Nullary functor called by this library to check preconditions <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="precondition_failure.html" title="Function precondition_failure">boost::contract::precondition_failure</a></code></code>). This functor should capture variables by (constant) value, or better by (constant) reference (to avoid extra copies).</p></td>
100 </tr></tbody>
101 </table></div></td>
102 </tr>
103 <tr>
104 <td><p><span class="term">Returns:</span></p></td>
105 <td><p>After preconditions have been specified, the object returned by this function allows to optionally specify old value copies at body, postconditions, and exception guarantees. </p></td>
106 </tr>
107 </tbody>
108 </table></div>
109 </li>
110 <li class="listitem">
111 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> 
112   <a class="link" href="specify__idm45123870066880.html" title="Class template specify_postcondition_except">specify_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <a name="idm45123870023552-bb"></a><span class="identifier">old</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 old value copies at body. <p>It should often be sufficient to initialize old value pointers as soon as they are declared, without using this function (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.old_value_copies_at_body" title="Old Value Copies at Body"> Old Value Copies at Body</a>).</p>
113 <p>
114
115 </p>
116 <div class="variablelist"><table border="0" class="variablelist compact">
117 <colgroup>
118 <col align="left" valign="top">
119 <col>
120 </colgroup>
121 <tbody>
122 <tr>
123 <td><p><span class="term">Parameters:</span></p></td>
124 <td><div class="variablelist"><table border="0" class="variablelist compact">
125 <colgroup>
126 <col align="left" valign="top">
127 <col>
128 </colgroup>
129 <tbody><tr>
130 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
131 <td><p>Nullary functor called by this library <code class="computeroutput">f()</code> to assign old value copies just before the body is executed but after entry invariants (when they apply) and preconditions are checked. Old value pointers within this functor call are usually assigned using <code class="computeroutput"><code class="computeroutput"><a class="link" href="../../BOOST_CONTRACT_OLDOF.html" title="Macro BOOST_CONTRACT_OLDOF">BOOST_CONTRACT_OLDOF</a></code></code>. Any exception thrown by a call to this functor will result in this library calling <code class="computeroutput"><code class="computeroutput"><a class="link" href="old_failure.html" title="Function old_failure">boost::contract::old_failure</a></code></code> (because old values could not be copied to check postconditions and exception guarantees). This functor should capture old value pointers by references so they can be assigned (all other variables needed to evaluate old value expressions can be captured by (constant) value, or better by (constant) reference to avoid extra copies).</p></td>
132 </tr></tbody>
133 </table></div></td>
134 </tr>
135 <tr>
136 <td><p><span class="term">Returns:</span></p></td>
137 <td><p>After old value copies at body have been specified, the object returned by this functions allows to optionally specify postconditions and exception guarantees. </p></td>
138 </tr>
139 </tbody>
140 </table></div>
141 </li>
142 <li class="listitem">
143 <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="idm45123870015056-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>
144
145 </p>
146 <div class="variablelist"><table border="0" class="variablelist compact">
147 <colgroup>
148 <col align="left" valign="top">
149 <col>
150 </colgroup>
151 <tbody>
152 <tr>
153 <td><p><span class="term">Parameters:</span></p></td>
154 <td><div class="variablelist"><table border="0" class="variablelist compact">
155 <colgroup>
156 <col align="left" valign="top">
157 <col>
158 </colgroup>
159 <tbody><tr>
160 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
161 <td><p>Functor called by this library to check postconditions <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="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 if <code class="computeroutput">VirtualResult</code> is <code class="computeroutput">void</code>, otherwise it must be a unary functor accepting the return value 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>
162 </tr></tbody>
163 </table></div></td>
164 </tr>
165 <tr>
166 <td><p><span class="term">Returns:</span></p></td>
167 <td><p>After postconditions have been specified, the object returned by this function allows to optionally specify exception guarantees. </p></td>
168 </tr>
169 </tbody>
170 </table></div>
171 </li>
172 <li class="listitem">
173 <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="idm45123870005808-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>
174
175 </p>
176 <div class="variablelist"><table border="0" class="variablelist compact">
177 <colgroup>
178 <col align="left" valign="top">
179 <col>
180 </colgroup>
181 <tbody>
182 <tr>
183 <td><p><span class="term">Parameters:</span></p></td>
184 <td><div class="variablelist"><table border="0" class="variablelist compact">
185 <colgroup>
186 <col align="left" valign="top">
187 <col>
188 </colgroup>
189 <tbody><tr>
190 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
191 <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>
192 </tr></tbody>
193 </table></div></td>
194 </tr>
195 <tr>
196 <td><p><span class="term">Returns:</span></p></td>
197 <td><p>After exception guarantees have been specified, the object returned by this function does not allow to specify any additional contract. </p></td>
198 </tr>
199 </tbody>
200 </table></div>
201 </li>
202 </ol></div>
203 </div>
204 </div>
205 </div>
206 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
207 <td align="left"></td>
208 <td align="right"><div class="copyright-footer">Copyright &#169; 2008-2018 Lorenzo Caminiti<p>
209         Distributed under the Boost Software License, Version 1.0 (see accompanying
210         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>)
211       </p>
212 </div></td>
213 </tr></table>
214 <hr>
215 <div class="spirit-nav">
216 <a accesskey="p" href="specify__idm45123870066880.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="virtual_.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
217 </div>
218 </body>
219 </html>