Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / contract / doc / html / boost / contract / call_if__idm45395000042848.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, ThenResult&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__idm45395000058976.html" title="Struct template call_if_statement&lt;true, Then, internal_type&gt;">
10 <link rel="next" href="call_if__idm45395000002720.html" title="Struct template call_if_statement&lt;true, Then, void&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__idm45395000058976.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__idm45395000002720.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="refentry">
26 <a name="boost.contract.call_if__idm45395000042848"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Struct template call_if_statement&lt;true, Then, ThenResult&gt;</span></h2>
29 <p>boost::contract::call_if_statement&lt;true, Then, ThenResult&gt; &#8212; Template specialization to handle static predicates that are <code class="computeroutput">true</code> for then-branch functor template calls that do not return void (not needed on C++17 compilers, use <code class="computeroutput">if constexpr</code> instead). </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">,</span> <span class="keyword">typename</span> ThenResult<span class="special">&gt;</span> 
35 <span class="keyword">struct</span> <a class="link" href="call_if__idm45395000042848.html" title="Struct template call_if_statement&lt;true, Then, ThenResult&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">ThenResult</span><span class="special">&gt;</span> <span class="special">{</span>
36   <span class="comment">// <a class="link" href="call_if__idm45395000042848.html#boost.contract.call_if__idm45395000042848construct-copy-destruct">construct/copy/destruct</a></span>
37   <span class="keyword">explicit</span> <a class="link" href="call_if__idm45395000042848.html#idm45395000007120-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>
38
39   <span class="comment">// <a class="link" href="call_if__idm45395000042848.html#idm45395000033040-bb">public member functions</a></span>
40   <a class="link" href="call_if__idm45395000042848.html#idm45395000032480-bb"><span class="keyword">operator</span> <span class="identifier">ThenResult</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
41   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Else<span class="special">&gt;</span> <span class="identifier">ThenResult</span> <a class="link" href="call_if__idm45395000042848.html#idm45395000030976-bb"><span class="identifier">else_</span></a><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
42   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
43     <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">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">ThenResult</span> <span class="special">&gt;</span> 
44     <a class="link" href="call_if__idm45395000042848.html#idm45395000024480-bb"><span class="identifier">else_if_c</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
45   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
46     <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">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">ThenResult</span> <span class="special">&gt;</span> 
47     <a class="link" href="call_if__idm45395000042848.html#idm45395000015744-bb"><span class="identifier">else_if</span></a><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
48 <span class="special">}</span><span class="special">;</span></pre></div>
49 <div class="refsect1">
50 <a name="idm45707997968256"></a><h2>Description</h2>
51 <p>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>
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="idm45707997962800"></a><h3>Template Parameters</h3>
62 <div class="orderedlist"><ol class="orderedlist" type="1">
63 <li class="listitem">
64 <pre class="literallayout"><span class="keyword">typename</span> Then</pre>
65 <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>
66 </li>
67 <li class="listitem">
68 <pre class="literallayout"><span class="keyword">typename</span> ThenResult</pre>
69 <p>Non-void return type of the then-branch functor template call. </p>
70 </li>
71 </ol></div>
72 </div>
73 <div class="refsect2">
74 <a name="idm45707997956816"></a><h3>
75 <a name="boost.contract.call_if__idm45395000042848construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code> 
76         public
77        construct/copy/destruct</h3>
78 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
79 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idm45395000007120-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>
80 </p>
81 <div class="variablelist"><table border="0" class="variablelist compact">
82 <colgroup>
83 <col align="left" valign="top">
84 <col>
85 </colgroup>
86 <tbody><tr>
87 <td><p><span class="term">Parameters:</span></p></td>
88 <td><div class="variablelist"><table border="0" class="variablelist compact">
89 <colgroup>
90 <col align="left" valign="top">
91 <col>
92 </colgroup>
93 <tbody><tr>
94 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
95 <td><p>Then-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is actually compiled and executed 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 <code class="computeroutput">ThenResult</code> type. </p></td>
96 </tr></tbody>
97 </table></div></td>
98 </tr></tbody>
99 </table></div>
100 </li></ol></div>
101 </div>
102 <div class="refsect2">
103 <a name="idm45707997943152"></a><h3>
104 <a name="idm45395000033040-bb"></a><code class="computeroutput">call_if_statement</code> public member functions</h3>
105 <div class="orderedlist"><ol class="orderedlist" type="1">
106 <li class="listitem">
107 <pre class="literallayout"><a name="idm45395000032480-bb"></a><span class="keyword">operator</span> <span class="identifier">ThenResult</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>This implicit type conversion returns a copy of the value returned by the call to the then-branch functor template. </li>
108 <li class="listitem">
109 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Else<span class="special">&gt;</span> <span class="identifier">ThenResult</span> <a name="idm45395000030976-bb"></a><span class="identifier">else_</span><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify the else-branch functor template. <p>
110
111 </p>
112 <div class="variablelist"><table border="0" class="variablelist compact">
113 <colgroup>
114 <col align="left" valign="top">
115 <col>
116 </colgroup>
117 <tbody>
118 <tr>
119 <td><p><span class="term">Parameters:</span></p></td>
120 <td><div class="variablelist"><table border="0" class="variablelist compact">
121 <colgroup>
122 <col align="left" valign="top">
123 <col>
124 </colgroup>
125 <tbody><tr>
126 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
127 <td><p>Else-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled or executed 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 <code class="computeroutput">ThenResult</code> type.</p></td>
128 </tr></tbody>
129 </table></div></td>
130 </tr>
131 <tr>
132 <td><p><span class="term">Returns:</span></p></td>
133 <td><p>A copy of the value returned by the call to the then-branch functor template (because the else-branch functor template call is not executed). </p></td>
134 </tr>
135 </tbody>
136 </table></div>
137 </li>
138 <li class="listitem">
139 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
140   <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">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">ThenResult</span> <span class="special">&gt;</span> 
141   <a name="idm45395000024480-bb"></a><span class="identifier">else_if_c</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a static boolean predicate). <p>
142
143
144 </p>
145 <div class="variablelist"><table border="0" class="variablelist compact">
146 <colgroup>
147 <col align="left" valign="top">
148 <col>
149 </colgroup>
150 <tbody>
151 <tr>
152 <td><p><span class="term">Parameters:</span></p></td>
153 <td><div class="variablelist"><table border="0" class="variablelist compact">
154 <colgroup>
155 <col align="left" valign="top">
156 <col>
157 </colgroup>
158 <tbody><tr>
159 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
160 <td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled or executed 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 <code class="computeroutput">ThenResult</code> type.</p></td>
161 </tr></tbody>
162 </table></div></td>
163 </tr>
164 <tr>
165 <td><p><span class="term">Template Parameters:</span></p></td>
166 <td><div class="variablelist"><table border="0" class="variablelist compact">
167 <colgroup>
168 <col align="left" valign="top">
169 <col>
170 </colgroup>
171 <tbody><tr>
172 <td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
173 <td><p>Static boolean predicate selecting which functor template call to compile and execute.</p></td>
174 </tr></tbody>
175 </table></div></td>
176 </tr>
177 <tr>
178 <td><p><span class="term">Returns:</span></p></td>
179 <td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will be the return value of the then-branch functor template call for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). </p></td>
180 </tr>
181 </tbody>
182 </table></div>
183 </li>
184 <li class="listitem">
185 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">&gt;</span> 
186   <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">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">ThenResult</span> <span class="special">&gt;</span> 
187   <a name="idm45395000015744-bb"></a><span class="identifier">else_if</span><span class="special">(</span><span class="identifier">ElseIfThen</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify an else-if-branch functor template (using a nullary boolean meta-function). <p>
188
189
190 </p>
191 <div class="variablelist"><table border="0" class="variablelist compact">
192 <colgroup>
193 <col align="left" valign="top">
194 <col>
195 </colgroup>
196 <tbody>
197 <tr>
198 <td><p><span class="term">Parameters:</span></p></td>
199 <td><div class="variablelist"><table border="0" class="variablelist compact">
200 <colgroup>
201 <col align="left" valign="top">
202 <col>
203 </colgroup>
204 <tbody><tr>
205 <td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
206 <td><p>Else-if-branch nullary functor template. The functor template call <code class="computeroutput">f()</code> is never compiled or executed 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 <code class="computeroutput">ThenResult</code> type.</p></td>
207 </tr></tbody>
208 </table></div></td>
209 </tr>
210 <tr>
211 <td><p><span class="term">Template Parameters:</span></p></td>
212 <td><div class="variablelist"><table border="0" class="variablelist compact">
213 <colgroup>
214 <col align="left" valign="top">
215 <col>
216 </colgroup>
217 <tbody><tr>
218 <td><p><span class="term"><code class="computeroutput">ElseIfPred</code></span></p></td>
219 <td><p>Nullary boolean meta-function selecting which functor template call to compile and execute.</p></td>
220 </tr></tbody>
221 </table></div></td>
222 </tr>
223 <tr>
224 <td><p><span class="term">Returns:</span></p></td>
225 <td><p>A call-if statement so the else statement and additional else-if statements can be specified if needed. Eventually, it will be the return value of the then-branch functor template call for this template specialization (because the if-statement static predicate is <code class="computeroutput">true</code>). </p></td>
226 </tr>
227 </tbody>
228 </table></div>
229 </li>
230 </ol></div>
231 </div>
232 </div>
233 </div>
234 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
235 <td align="left"></td>
236 <td align="right"><div class="copyright-footer">Copyright &#169; 2008-2019 Lorenzo Caminiti<p>
237         Distributed under the Boost Software License, Version 1.0 (see accompanying
238         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>)
239       </p>
240 </div></td>
241 </tr></table>
242 <hr>
243 <div class="spirit-nav">
244 <a accesskey="p" href="call_if__idm45395000058976.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__idm45395000002720.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
245 </div>
246 </body>
247 </html>