mirror of
https://github.com/boostorg/mpl.git
synced 2026-01-26 17:02:20 +01:00
62 lines
2.6 KiB
HTML
62 lines
2.6 KiB
HTML
<!doctype html public "-//ietf//dtd html//en">
|
|
<html><head><title>boost::mpl::or_</title>
|
|
<link rel="stylesheet" href="../mpl_wiki.css">
|
|
</head><body bgcolor="white">
|
|
<h1><a href="../Table_of_Contents.html"><img src="../mpl_logo.jpg" alt="[Home]" border=0 align="right"></a>or_</h1><h3>Synopsis</h3>
|
|
<p>
|
|
<pre>
|
|
template<
|
|
typename F1
|
|
, typename F2
|
|
, typename F3 = false_
|
|
...
|
|
, typename Fn = false_
|
|
>
|
|
struct or_
|
|
{
|
|
typedef <em>unspecified</em> type;
|
|
};
|
|
</pre>
|
|
<p>
|
|
<h3>Description</h3>
|
|
<p>
|
|
Returns the result of short-circuit <em>logical or</em> (<code>||</code>) operation on its arguments.
|
|
<p>
|
|
<h3>Definition</h3>
|
|
<p>
|
|
<pre>
|
|
#include "<a href="../../../../../boost/mpl/or.hpp">boost/mpl/or.hpp</a>"
|
|
</pre>
|
|
<p>
|
|
<h3>Parameters</h3>
|
|
<table border="1">
|
|
<tr><th> Parameter </th><th> Requirement </th><th> Description </th></tr>
|
|
<tr><td><code>F1, F2, .., Fn</code></td><td>A model of nullary <a href="../Metafunction.html">Metafunction</a></td><td></td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Expression semantics</h3>
|
|
<p>
|
|
<table border="1">
|
|
<tr><th> Expression </th><th> Expression type </th><th> Precondition </th><th> Semantics </th><th> Postcondition </th></tr>
|
|
<tr><td><code>or_<f1,f2,..,fn></code></td><td>A model of <code>bool</code> <a href="../Integral_Constant.html">Integral Constant</a></td><td></td><td><code>true_</code> if either of <code>f1::type::value, f2::type::value, .., fn::type::value</code> expressions evaluates to true, and <code>false_</code> otherwise; guarantees left-to-right evaluation; moreover, the operands subsequent to the first <code>fi</code> metafunction that evaluates to true are not evaluated.</td><td></td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Example</h3>
|
|
<p>
|
|
<pre>
|
|
<span class="cxx-comment">// will generate compile-time error if invoked with T == any fundamental type</span>
|
|
template< typename T > struct fail
|
|
{
|
|
typedef typename T::nonexistent type;
|
|
};
|
|
<p>
|
|
BOOST_STATIC_ASSERT((or_< false_,true_ >::value == true));
|
|
BOOST_STATIC_ASSERT((or_< true_,fail<int> >::value == true)); <span class="cxx-comment">// OK, fail<int> is never invoked</span>
|
|
BOOST_STATIC_ASSERT((or_< false_,true_,fail<int> >::value == true)); <span class="cxx-comment">// OK too</span>
|
|
</pre>
|
|
<p>
|
|
<h3>See also</h3>
|
|
<p>
|
|
<a href="../Metafunctions.html">Metafunctions</a>, <code><a href="../Reference/and.html">and_</a></code>, <code><a href="../Reference/not.html">not_</a></code>
|
|
<p><hr>
|
|
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited September 6, 2003 3:14 am</body></html> |