The std::ratio_less
class template provides a mechanism for comparing two std::ratio values at compile time,
using rational arithmetic.
template <class R1, class R2> class ratio_less: public see below {};
R1 and R2
must be instantiations of the std::ratio class template.
The value of std::ratio_less<R1,R2>
is (R1::num*R2::den) < (R2::num*R1::den),
determined in a way that avoids integer overflow.
If the TR1 std::tr1::integral_constant class template is available,
then std::ratio_less<R1,R2> derives from std::tr1::integral_constant<bool, value >. Otherwise, std::ratio_less<R1,R2>
derives from an internal type that provides a static constant data member
value of type bool equal to value.
std::ratio_less< std::ratio<1,3>, std::ratio<2,6> >::value == false std::ratio_less< std::ratio<1,6>, std::ratio<1,3> >::value == true std::ratio_less< std::ratio<999999999,1000000000>, std::ratio<1000000001,1000000000> >::value == true std::ratio_less< std::ratio<1000000001,1000000000>, std::ratio<999999999,1000000000> >::value == false
Header
#include <ratio>