negate.rst
来自「C++的一个好库。。。现在很流行」· RST 代码 · 共 111 行
RST
111 行
.. Metafunctions/Arithmetic Operations//negate |60
negate
======
Synopsis
--------
.. parsed-literal::
template<
typename T
>
struct negate
{
typedef |unspecified| type;
};
Description
-----------
Returns the negative (additive inverse) of its argument.
Header
------
.. parsed-literal::
#include <boost/mpl/negate.hpp>
#include <boost/mpl/arithmetic.hpp>
Model of
--------
|Numeric Metafunction|
Parameters
----------
+---------------+---------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================================+
| ``T`` | |Integral Constant| | Operation's argument. |
+---------------+---------------------------+-----------------------------------------------+
|Note:| |numeric metafunction note| |-- end note|
Expression semantics
--------------------
For any |Integral Constant| ``c``:
.. parsed-literal::
typedef negate<c>::type r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef integral_c< c::value_type, ( -c::value ) > r;
.. ..........................................................................
.. parsed-literal::
typedef negate<c> r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
struct r : negate<c>::type {};
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef negate< int_<-10> >::type r;
BOOST_MPL_ASSERT_RELATION( r::value, ==, 10 );
BOOST_MPL_ASSERT(( is_same< r::value_type, int > ));
See also
--------
|Arithmetic Operations|, |Numeric Metafunction|, |numeric_cast|, |plus|, |minus|, |times|
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?