Imported Upstream version 1.71.0
[platform/upstream/boost.git] / libs / contract / doc / html / boost / contract / call_if__idm45123870909024.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Struct template call_if_statement&lt;true, Then, internal_type&gt;</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.call_if_hpp" title="Header &lt;boost/contract/call_if.hpp&gt;">
9 <link rel="prev" href="call_if__idm45123870948032.html" title="Struct template call_if_statement&lt;false, Then, internal_type&gt;">
10 <link rel="next" href="call_if__idm45123870893360.html" title="Struct template call_if_statement&lt;true, Then, ThenResult&gt;">
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="call_if__idm45123870948032.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_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="call_if__idm45123870893360.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="refentry">
26 <a name="boost.contract.call_if__idm45123870909024"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Struct template call_if_statement&lt;true, Then, internal_type&gt;</span></h2>
29 <p>boost::contract::call_if_statement&lt;true, Then, internal_type&gt; &#8212; Template specialization to dispatch between then-branch functor template calls that return void and the ones that return non-void. </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.call_if_hpp" title="Header &lt;boost/contract/call_if.hpp&gt;">boost/contract/call_if.hpp</a>&gt;
33
34 </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Then<span class="special">&gt;</span> 
35 <span class="keyword">struct</span> <a class="link" href="call_if__idm45123870909024.html" title="Struct template call_if_statement&lt;true, Then, internal_type&gt;">call_if_statement</a><span class="special">&lt;</span><span class="keyword">true</span><span class="special">,</span> <span class="identifier">Then</span><span class="special">,</span> <span class="identifier">internal_type</span><span class="special">&gt;</span> <span class="special">:</span> <span class="keyword">public</span> boost::contract::call_if_statement&lt; true, Then, result_of&lt; Then()&gt;::type &gt;
36 <span class="special">{</span>
37   <span class="comment">// <a class="link" href="call_if__idm45123870909024.html#boost.contract.call_if__idm45123870909024construct-copy-destruct">construct/copy/destruct</a></span>
38   <span class="keyword">explicit</span> <a class="link" href="call_if__idm45123870909024.html#idm45123870897376-bb"><span class="identifier">call_if_statement</span></a><span class="special">(</span><span class="identifier">Then</span><span class="special">)</span><span class="special">;</span>
39 <span class="special">}</span><span class="special">;</span></pre></div>
40 <div class="refsect1">
41 <a name="idm45751731503840"></a><h2>Description</h2>
42 <p>The base class is a call-if statement so the else and else-if statements can be specified if needed. Usually this class template is instantiated only via the return value of  <code class="computeroutput"><a class="link" href="call_if.html" title="Function template call_if">boost::contract::call_if</a></code> and <code class="computeroutput"><a class="link" href="call_if_c.html" title="Function template call_if_c">boost::contract::call_if_c</a></code>.</p>
43 <div class="note"><table border="0" summary="Note">
44 <tr>
45 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
46 <th align="left">Note</th>
47 </tr>
48 <tr><td align="left" valign="top"><p>The <code class="computeroutput">result_of&lt;Then()&gt;::type</code> expression should be evaluated only when the static predicate is already checked to be <code class="computeroutput">true</code> (because <code class="computeroutput">Then()</code> is required to compile only in that case). Thus, this template specialization introduces an extra level of indirection necessary for proper lazy evaluation of this result-of expression.</p></td></tr>
49 </table></div>
50 <p>
51 </p>
52 <p><span class="bold"><strong>See Also:</strong></span></p>
53 <p> <a class="link" href="../../boost_contract/extras.html#boost_contract.extras.assertion_requirements__templates_" title="Assertion Requirements (Templates)">
54         Assertion Requirements</a></p>
55 <p>
56 </p>
57 <p>
58
59 </p>
60 <div class="refsect2">
61 <a name="idm45751731495248"></a><h3>Template Parameters</h3>
62 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
63 <pre class="literallayout"><span class="keyword">typename</span> Then</pre>
64 <p>Type of functor template to call when the static predicate is <code class="computeroutput">true</code> (as it is for this template specialization). </p>
65 </li></ol></div>
66 </div>
67 <div class="refsect2">
68 <a name="idm45751731491376"></a><h3>
69 <a name="boost.contract.call_if__idm45123870909024construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code> 
70         public
71        construct/copy/destruct</h3>
72 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
73 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idm45123870897376-bb"></a><span class="identifier">call_if_statement</span><span class="special">(</span><span class="identifier">Then</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object with the then-branch functor template. <p>
74 </p>
75 <div class="variablelist"><table border="0" class="variablelist compact">
76 <colgroup>
77 <col align="left" valign="top">
78 <col>
79 </colgroup>
80 <tbody><tr>
81 <td><p><span class="term">Parameters:</span></p></td>
82 <td><div class="variablelist"><table border="0" class="variablelist compact">
83 <colgroup>
84 <col align="left" valign="top">
85 <col>
86 </colgroup>
87 <tbody><tr>
88 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
89 <td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is compiled and called for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). The return type of <code class="computeroutput">f()</code> must be the same as (or implicitly convertible to) the return type of all other functor template calls specified for this call-if object. </p></td>
90 </tr></tbody>
91 </table></div></td>
92 </tr></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 &#169; 2008-2018 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="call_if__idm45123870948032.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.call_if_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="call_if__idm45123870893360.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
109 </div>
110 </body>
111 </html>