首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::ratio_less

Defined in header <ratio>

?

?

template< class R1, class R2 > struct ratio_less : std::integral_constant;

?

?

如果r1小于r2,则提供成员常量。value平等true.否则,valuefalse...

辅助变量模板

template< class R1, class R2 > inline constexpr bool ratio_less_v = ratio_less<R1, R2>::value;

?

(since C++17)

继承自STD:积分[医]常量

成员常数

value static

true if R1::num * R2::den < R2::num * R1::den, or equivalent expression that avoids overflow , false otherwise (public static member constant)

成员函数

operator bool

converts the object to bool, returns value (public member function)

operator() (C++14)

returns value (public member function)

成员类型

Type

Definition

value_type

bool

type

std::integral_constant<bool, value>

二次

代码语言:javascript
复制
#include <iostream>
#include <ratio>
 
int main()
{
    if (std::ratio_less<std::ratio<23,37>, std::ratio<57,90>>::value) {
        std::cout << "23/37 < 57/90\n";
    }
}

二次

产出:

二次

代码语言:javascript
复制
23/37 < 57/90

二次

另见

二次

*。

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com