LCM Function Object

| Home | Libraries | People | FAQ | More

### LCM Function Object

Header: <boost/math/common_factor_rt.hpp>

    template < typename IntegerType >
    class boost::math::lcm_evaluator
    {
    public:
       // Types
       typedef IntegerType  result_type;
       typedef IntegerType  first_argument_type;
       typedef IntegerType  second_argument_type;

       // Function object interface
       result_type  operator ()( first_argument_type const &a,
       second_argument_type const &b ) const;
    };

The boost::math::lcm_evaluator class template defines a function object class to return the least common multiple of two integers. The template is parameterized by a single type, called IntegerType here. This type should be a numeric type that represents integers. The result of the function object is always nonnegative, even if either of the operator arguments is negative. If the least common multiple is beyond the range of the integer type, the results are undefined.

This function object class template is used in the corresponding version of the LCM function template. If a numeric type wants to customize evaluations of its least common multiples, then the type should specialize on the lcm_evaluator class template.