Boost C++ Libraries

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

The MPL Reference Manual: min
Front Page / Metafunctions / Miscellaneous / min

min

Synopsis

template<
      typename N1
    , typename N2
    >
struct min
{
    typedef unspecified type;
};

Description

Returns the smaller of its two arguments.

Parameters

Parameter Requirement Description
N1, N2 Any type Types to compare.

Expression semantics

For arbitrary types x and y:

typedef min::type r;
Return type:

A type.

Precondition:

less::value is a well-formed integral constant expression.

Semantics:

Equivalent to

typedef if_< less,x,y >::type r;

Complexity

Constant time.

Example

typedef fold<
      vector_c
    , int_<-10>
    , min<_1,_2>
    >::type r;

BOOST_MPL_ASSERT(( is_same< r, int_<-10> > ));