std::experimental::ranges::greater
template<
class T
= void
>
requires ranges::StrictTotallyOrdered<T>
|| |
(范围 TS) | |
template
<>
struct greater<void>; |
(范围 TS) | |
进行比较的函数对象。初等模板在 T
类型 const 左值上以倒序调用 operator< 。特化
greater<void>
从实参推导函数调用运算符的形参类型(但非返回类型)。
greater
的所有特化均为 Semiregular
。
成员类型
成员类型 | 定义 |
is_transparent (仅为
greater<void> 特化的成员)
|
/* 未指定 */ |
成员函数
operator()
|
检查第一参数是否大于第二个 (公开成员函数) |
std::experimental::ranges::greater::operator()
constexpr
bool
operator()(const
T&
x, const
T&
y)
const;
|
(1) | (仅为初等
greater<T>
模板的成员) |
template<
class
T, class
U >
requires ranges::StrictTotallyOrderedWith<T,
U>
|| |
(2) | (仅为
greater<void>
特化的成员) |
x
与
y
。等价于 return ranges::less<>{}(y, x) ;
注意
不同于 std::greater
, ranges::greater
要求全部六个比较运算符 <
、
<=
、 >
、 >=
、
==
及 !=
均合法(通过 StrictTotallyOrdered
与 StrictTotallyOrderedWith
制约)并且完全以
ranges::less 定义。然而,实现可以自由地直接使用 operator>
,因为这些概念要求比较运算符的结果一致。
示例
本节未完成 原因:暂无示例 |
参阅
实现 x >
y 的函数对象 (类模板) |