Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added boost

File size: 2.2 KB

plus

Synopsis

template<
      typename T1
    , typename T2
    , typename T3 = |unspecified|
    |...|
    , typename Tn = |unspecified|
    >
struct plus
{
    typedef |unspecified| type;
};

Description

Returns the sum of its arguments.

Parameters

Parameter Requirement Description
|T1...Tn| |Integral Constant| Operation's arguments.

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

Expression semantics

For any |Integral Constant|s |c1...cn|:

typedef plus<c1,|...|cn>::type r;
Return type:

|Integral Constant|.

Semantics:

Equivalent to

typedef integral_c<
      typeof(c1::value + c2::value)
    , ( c1::value + c2::value )
    > c;
typedef plus<c,c3,|...|cn>::type r;
typedef plus<c1,|...|cn> r;
Return type:

|Integral Constant|.

Semantics:

Equivalent to

struct r : plus<c1,|...|cn>::type {};

Complexity

Amortized constant time.

Example

typedef plus< int_<-10>, int_<3>, long_<1> >::type r;
BOOST_MPL_ASSERT_RELATION( r::value, ==, -6 );
BOOST_MPL_ASSERT(( is_same< r::value_type, long > ));

Docutils System Messages

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