# negate

### Synopsis

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

### Description

Returns the negative (additive inverse) of its argument [1].

### Definition

    #include "boost/mpl/negate.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`T` | A model of Integral Constant |

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef negate<t>::type n;` | A model of Integral Constant |  | Equivalent to `typedef integral_c<t::value_type, -t::value> n;` |

### Complexity

Amortized constant time.

### Example

    typedef negate< integral_c<short,-10> >::type n;
    BOOST_STATIC_ASSERT(n::value == 10));
    BOOST_MPL_ASSERT_IS_SAME(n::value_type, short);

### Notes

[1] The `negate` metafunction can be (and is expected to be) specialized by user to work on user-defined types that do not satisfy the Integral Constant requirements. The requirements listed here are the ones imposed by the default implementation.

### See also

Metafunctions, `minus`, `plus`, `multiplies`, `divides`, `modulus`

Table of Contents
Last edited March 10, 2003 6:33 am