Front Page / Metafunctions / Arithmetic Operations / divides

# divides

### Synopsis

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

### Description

Returns the quotient of its arguments.

### Header

    #include <boost/mpl/divides.hpp>
    #include <boost/mpl/arithmetic.hpp>

### Model of

Numeric Metafunction

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`T1`, `T2`,... `Tn` | Integral Constant | Operation's arguments.

[Note: The requirements listed in this specification are the ones imposed by the default implementation. See Numeric Metafunction concept for the details on how to provide an implementation for a user-defined numeric type that does not satisfy the Integral Constant requirements. — end note]

### Expression semantics

For any Integral Constants c1,c2,... cn:

    typedef divides<c1,...cn>::type r;

Return type: | Integral Constant.
Precondition: | `c2::value != 0`, ... `cn::value != 0`.

Semantics:

Equivalent to

    typedef integral_c<
          typeof(c1::value / c2::value)
        , ( c1::value / c2::value )
        > c;

    typedef divides<c,c3,...cn>::type r;

    typedef divides<c1,...cn> r;

Return type: | Integral Constant.
Precondition: | `c2::value != 0`, ... `cn::value != 0`.

Semantics:

Equivalent to

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

### Complexity

Amortized constant time.

### Example

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

### See also

Arithmetic Operations, Numeric Metafunction, numeric_cast, times, modulus, plus