Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is an old version of boost. Click here for the latest version's documentation home page.



      typename T1
    , typename T2
    , typename T3 = integral_c<int,0>
    , ...
    , typename Tn = integral_c<int,0>
struct minus
    typedef unspecified type;


Returns the difference of its arguments [1].


#include "boost/mpl/minus.hpp"


 Parameter  Requirement  Description  
T1, T2, .., TnA model of Integral Constant

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef minus<t1,t2,..,tn>::type diff;A model of Integral ConstantEquivalent to typedef integral_c<typeof(t1::value - t2::value .. - tn::value), t1::value - t2::value .. - tn::value > diff;


Amortized constant time.


typedef minus< integral_c<short,-1>, integral_c<long,10> >::type diff;
BOOST_STATIC_ASSERT(diff::value == -11));
BOOST_MPL_ASSERT_IS_SAME(diff::value_type, long);


[1] The minus 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, plus, divides, multiplies, modulus, negate

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