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

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

[Home]divides

Synopsis

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

Description

Returns the quotient of its arguments [1].

Definition

#include "boost/mpl/divides.hpp"

Parameters

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

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef divides<t1,t2,..,tn>::type quot;A model of Integral Constantt2::value != 0, t3::value != 0, .., tn::value != 0Equivalent to typedef integral_c<typeof(t1::value / t2::value .. / tn::value), t1::value / t2::value .. / tn::value > quot;

Complexity

Amortized constant time.

Example

typedef divides< integral_c<short,-10>, integral_c<long,3> >::type quot;
BOOST_STATIC_ASSERT(quot::value == -3));
BOOST_MPL_ASSERT_IS_SAME(quot::value_type, long);

Notes

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


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