Files
mpl/doc/ref/Reference/equal_to.html
Aleksey Gurtovoy a69baa5eae update the docs
[SVN r17836]
2003-03-12 13:29:12 +00:00

61 lines
2.8 KiB
HTML

<!doctype html public "-//ietf//dtd html//en">
<html><head><title>boost::mpl::equal_to</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>equal_to</h1><h3>Synopsis</h3>
<p>
<pre>
template&lt;
typename T1
, typename T2
&gt;
struct equal_to
{
typedef <em>unspecified</em> type;
};
</pre>
<p>
<h3>Description</h3>
<p>
Returns <code>true_</code> if <code>T1::value == T2::value</code> and <code>false_</code> otherwise [<a href="#1">1</a>].
<p>
<h3>Definition</h3>
<p>
<pre>
#include "<a href="../../../../../boost/mpl/equal_to.hpp">boost/mpl/equal_to.hpp</a>"
</pre>
<p>
<h3>Parameters</h3>
<table border="1">
<tr><th>&nbsp;Parameter&nbsp;</th><th>&nbsp;Requirement&nbsp;</th><th>&nbsp;Description &nbsp;</th></tr>
<tr><td><code>T1, T2</code></td><td>A model of <a href="../Integral_Constant.html">Integral Constant</a></td><td></td></tr>
</table>
<p>
<h3>Expression semantics</h3>
<p>
<table border="1">
<tr><th>&nbsp;Expression&nbsp;</th><th>&nbsp;Expression&nbsp;type&nbsp;</th><th>&nbsp;Precondition&nbsp;</th><th>&nbsp;Semantics&nbsp;</th><th>&nbsp;Postcondition&nbsp;</th></tr>
<tr><td><code>typedef equal_to&lt;t1,t2&gt;::type c;</code></td><td>A model of <code>bool</code> <a href="../Integral_Constant.html">Integral Constant</a></td><td></td><td>Equivalent to <code>typedef bool_&lt;(t1::value == t2::value)&gt; c;</code></td><td></td></tr>
</table>
<p>
<h3>Complexity</h3>
<p>
Amortized constant time.
<p>
<h3>Example</h3>
<p>
<pre>
typedef <a href="../Reference/list_c.html">list_c</a>&lt;int,1,2,3,5,7,12,19,31&gt; fibonacci;
typedef <a href="../Reference/find_if.html">find_if</a>&lt; fibonacci, equal_to&lt;_1,int_&lt;12&gt; &gt; &gt;::type iter;
BOOST_STATIC_ASSERT(equal_to&lt; <a href="../Reference/distance.html">distance</a>&lt; <a href="../Reference/begin.html">begin</a>&lt;fibonacci&gt;::type, iter &gt;::type, int_&lt;5&gt; &gt;::type::value));
</pre>
<p>
<h3>Notes</h3>
<p>
[<a name="1">1</a>] The <code>equal_to</code> metafunction can be (and is expected to be) specialized by user to work on user-defined types that do not satisfy the <a href="../Integral_Constant.html">Integral Constant</a> requirements. The requirements listed here are the ones imposed by the default implementation.<br>
<p>
<h3>See also</h3>
<p>
<a href="../Metafunctions.html">Metafunctions</a>, <code><a href="../Reference/not_equal_to.html">not_equal_to</a></code>, <code><a href="../Reference/less.html">less</a></code>, <code><a href="../Reference/less_equal.html">less_equal</a></code>, <code><a href="../Reference/greater.html">greater</a></code>, <code><a href="../Reference/greater_equal.html">greater_equal</a></code>
<p><hr>
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited March 10, 2003 6:26 am</body></html>