Documentation Home >> Headers >> <ratio> Header >> std::ratio_not_equal class template

The std::ratio_not_equal class template provides a mechanism for comparing two std::ratio values for inequality at compile time, using rational arithmetic.

template <class R1, class R2>
class ratio_not_equal:
    public see below
{};

R1 and R2 must be instantiations of the std::ratio class template.

The value of std::ratio_not_equal<R1,R2> is (R1::num!=R2::num) || (R1::den!=R2::den).

If the TR1 std::tr1::integral_constant class template is available, then std::ratio_not_equal<R1,R2> derives from std::tr1::integral_constant<bool, value >. Otherwise, std::ratio_not_equal<R1,R2> derives from an internal type that provides a static constant data member value of type bool equal to value.

std::ratio_not_equal<
    std::ratio<1,3>, std::ratio<2,6> >::value == false
std::ratio_not_equal<
    std::ratio<1,3>, std::ratio<1,6> >::value == true
std::ratio_not_equal<
    std::ratio<1,3>, std::ratio<2,3> >::value == true
std::ratio_not_equal<
    std::ratio<1,3>, std::ratio<1,3> >::value == false
Header

#include <ratio>

See Also