mirror of
https://github.com/boostorg/mpl.git
synced 2026-01-26 17:02:20 +01:00
60 lines
2.4 KiB
HTML
60 lines
2.4 KiB
HTML
<!doctype html public "-//ietf//dtd html//en">
|
|
<html><head><title>boost::mpl::negate</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>negate</h1><h3>Synopsis</h3>
|
|
<p>
|
|
<pre>
|
|
template<
|
|
typename T
|
|
>
|
|
struct negate
|
|
{
|
|
typedef <em>unspecified</em> type;
|
|
};
|
|
</pre>
|
|
<p>
|
|
<h3>Description</h3>
|
|
<p>
|
|
Returns the negative (additive inverse) of its argument [<a href="#1">1</a>].
|
|
<p>
|
|
<h3>Definition</h3>
|
|
<p>
|
|
<pre>
|
|
#include "<a href="../../../../../boost/mpl/negate.hpp">boost/mpl/negate.hpp</a>"
|
|
</pre>
|
|
<p>
|
|
<h3>Parameters</h3>
|
|
<table border="1">
|
|
<tr><th> Parameter </th><th> Requirement </th><th> Description </th></tr>
|
|
<tr><td><code>T</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> Expression </th><th> Expression type </th><th> Precondition </th><th> Semantics </th><th> Postcondition </th></tr>
|
|
<tr><td><code>typedef negate<t>::type n;</code></td><td>A model of <a href="../Integral_Constant.html">Integral Constant</a></td><td></td><td>Equivalent to <code>typedef integral_c<t::value_type, -t::value> n;</code></td><td></td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Complexity</h3>
|
|
<p>
|
|
Amortized constant time.
|
|
<p>
|
|
<h3>Example</h3>
|
|
<p>
|
|
<pre>
|
|
typedef negate< integral_c<short,-10> >::type n;
|
|
BOOST_STATIC_ASSERT(n::value == 10));
|
|
BOOST_MPL_ASSERT_IS_SAME(n::value_type, short);
|
|
</pre>
|
|
<p>
|
|
<h3>Notes</h3>
|
|
<p>
|
|
[<a name="1">1</a>] The <code>negate</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/minus.html">minus</a></code>, <code><a href="../Reference/plus.html">plus</a></code>, <code><a href="../Reference/multiplies.html">multiplies</a></code>, <code><a href="../Reference/divides.html">divides</a></code>, <code><a href="../Reference/modulus.html">modulus</a></code>
|
|
<p><hr>
|
|
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited March 10, 2003 6:33 am</body></html> |