std::experimental::ranges::greater
來自 cppreference.com
< cpp | experimental | ranges
定義於標頭檔案 <experimental/ranges/functional> |
||
template< class T = void > requires StrictTotallyOrdered<T> || |
(Ranges TS) | |
template<> struct greater<void>; |
(Ranges 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 StrictTotallyOrderedWith<T, U> || |
(2) | (僅 greater<void> 特化的成員) |
[編輯] 註解
與 std::greater 不同,ranges::greater
要求所有六個比較運算子 <
、<=
、>
、>=
、==
和 !=
都有效(透過 StrictTotallyOrdered
和 StrictTotallyOrderedWith
約束),並且完全是根據 ranges::less 定義的。然而,實現可以自由地直接使用 operator>,因為這些概念要求比較運算子的結果是一致的。
[編輯] 示例
本節不完整 原因:無示例 |
[編輯] 參閱
實現 x > y 的函式物件 (類模板) |