C++ ratio std::ratio::ratio_not_equal














































C++ ratio std::ratio::ratio_not_equal



Description:
ratio_not_equal class template return true if the two ratio types R1 and R2 are not equal other wise return false.

Syntax
template <class R1, class R2> ratio_not_equal;

Template parameters

R1,R2
    ratio types to be compared.

Example

#include <iostream>
#include <ratio>
using namespace std;

int main ()
{
typedef ratio<1,2> one_half;
typedef ratio<1,3> one_thirds;

cout << "1/2 != 1/3 ? " << boolalpha ;
cout << ratio_not_equal<one_half , one_thirds>::value << endl;
cout << "1/2 != 1/2 ? " << boolalpha ;
cout << ratio_not_equal<
one_half, one_half>::value << endl;

return 0;
}



OUTPUT

1/2 != 1/3 ? true
1/2 != 1/2 ? false

Comments