Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/doc/src/refmanual/negate.rst @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 1.9 KB

negate

Synopsis

template<
      typename T
    >
struct negate
{
    typedef |unspecified| type;
};

Description

Returns the negative (additive inverse) of its argument.

Parameters

Parameter Requirement Description
T |Integral Constant| Operation's argument.

|Note:| |numeric metafunction note| |-- end note|

Expression semantics

For any |Integral Constant| c:

typedef negate<c>::type r;
Return type:

|Integral Constant|.

Semantics:

Equivalent to

typedef integral_c< c::value_type, ( -c::value ) > r;
typedef negate<c> r;
Return type:

|Integral Constant|.

Semantics:

Equivalent to

struct r : negate<c>::type {};

Complexity

Amortized constant time.

Example

typedef negate< int_<-10> >::type r;
BOOST_MPL_ASSERT_RELATION( r::value, ==, 10 );
BOOST_MPL_ASSERT(( is_same< r::value_type, int > ));

Docutils System Messages

???????????????
Note: See TracBrowser for help on using the repository browser.