3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Struct template call_if_statement<true, Then, ThenResult></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.call_if_hpp" title="Header <boost/contract/call_if.hpp>">
9 <link rel="prev" href="call_if__idm45123870909024.html" title="Struct template call_if_statement<true, Then, internal_type>">
10 <link rel="next" href="call_if__idm45123870853712.html" title="Struct template call_if_statement<true, Then, void>">
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>
22 <div class="spirit-nav">
23 <a accesskey="p" href="call_if__idm45123870909024.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__idm45123870853712.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
25 <div class="refentry">
26 <a name="boost.contract.call_if__idm45123870893360"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Struct template call_if_statement<true, Then, ThenResult></span></h2>
29 <p>boost::contract::call_if_statement<true, Then, ThenResult> — Template specialization to handle static predicates that are <code class="computeroutput">true</code> for then-branch functor template calls that do not return void. </p>
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.call_if_hpp" title="Header <boost/contract/call_if.hpp>">boost/contract/call_if.hpp</a>>
34 </span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Then<span class="special">,</span> <span class="keyword">typename</span> ThenResult<span class="special">></span>
35 <span class="keyword">struct</span> <a class="link" href="call_if__idm45123870893360.html" title="Struct template call_if_statement<true, Then, ThenResult>">call_if_statement</a><span class="special"><</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">></span> <span class="special">{</span>
36 <span class="comment">// <a class="link" href="call_if__idm45123870893360.html#boost.contract.call_if__idm45123870893360construct-copy-destruct">construct/copy/destruct</a></span>
37 <span class="keyword">explicit</span> <a class="link" href="call_if__idm45123870893360.html#idm45123870858112-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="comment">// <a class="link" href="call_if__idm45123870893360.html#idm45123870884032-bb">public member functions</a></span>
40 <a class="link" href="call_if__idm45123870893360.html#idm45123870883472-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"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="identifier">ThenResult</span> <a class="link" href="call_if__idm45123870893360.html#idm45123870881968-bb"><span class="identifier">else_</span></a><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
42 <span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
43 <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</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">></span>
44 <a class="link" href="call_if__idm45123870893360.html#idm45123870875472-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">&</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
45 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
46 <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</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">></span>
47 <a class="link" href="call_if__idm45123870893360.html#idm45123870866736-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">&</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="idm45751731412432"></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>
60 <div class="refsect2">
61 <a name="idm45751731407152"></a><h3>Template Parameters</h3>
62 <div class="orderedlist"><ol class="orderedlist" type="1">
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>
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>
73 <div class="refsect2">
74 <a name="idm45751731401168"></a><h3>
75 <a name="boost.contract.call_if__idm45123870893360construct-copy-destruct"></a><code class="computeroutput">call_if_statement</code>
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="idm45123870858112-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>
81 <div class="variablelist"><table border="0" class="variablelist compact">
83 <col align="left" valign="top">
87 <td><p><span class="term">Parameters:</span></p></td>
88 <td><div class="variablelist"><table border="0" class="variablelist compact">
90 <col align="left" valign="top">
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>
102 <div class="refsect2">
103 <a name="idm45751731387504"></a><h3>
104 <a name="idm45123870884032-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="idm45123870883472-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"><</span><span class="keyword">typename</span> Else<span class="special">></span> <span class="identifier">ThenResult</span> <a name="idm45123870881968-bb"></a><span class="identifier">else_</span><span class="special">(</span><span class="identifier">Else</span> <span class="keyword">const</span> <span class="special">&</span> f<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Specify the else-branch functor template. <p>
112 <div class="variablelist"><table border="0" class="variablelist compact">
114 <col align="left" valign="top">
119 <td><p><span class="term">Parameters:</span></p></td>
120 <td><div class="variablelist"><table border="0" class="variablelist compact">
122 <col align="left" valign="top">
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 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>
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>
138 <li class="listitem">
139 <pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">bool</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
140 <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</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">></span>
141 <a name="idm45123870875472-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">&</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>
145 <div class="variablelist"><table border="0" class="variablelist compact">
147 <col align="left" valign="top">
152 <td><p><span class="term">Parameters:</span></p></td>
153 <td><div class="variablelist"><table border="0" class="variablelist compact">
155 <col align="left" valign="top">
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 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>
165 <td><p><span class="term">Template Parameters:</span></p></td>
166 <td><div class="variablelist"><table border="0" class="variablelist compact">
168 <col align="left" valign="top">
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>
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>
184 <li class="listitem">
185 <pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> ElseIfPred<span class="special">,</span> <span class="keyword">typename</span> ElseIfThen<span class="special">></span>
186 <a class="link" href="call_if_statement.html" title="Struct template call_if_statement">call_if_statement</a><span class="special"><</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">></span>
187 <a name="idm45123870866736-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">&</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>
191 <div class="variablelist"><table border="0" class="variablelist compact">
193 <col align="left" valign="top">
198 <td><p><span class="term">Parameters:</span></p></td>
199 <td><div class="variablelist"><table border="0" class="variablelist compact">
201 <col align="left" valign="top">
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 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>
211 <td><p><span class="term">Template Parameters:</span></p></td>
212 <td><div class="variablelist"><table border="0" class="variablelist compact">
214 <col align="left" valign="top">
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>
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>
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 © 2008-2018 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>)
243 <div class="spirit-nav">
244 <a accesskey="p" href="call_if__idm45123870909024.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__idm45123870853712.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>