std::experimental::ranges::greater_equal

從 cppreference.com
< cpp‎ | experimental‎ | ranges
 
 
實驗性
技術規範
文件系統庫 (文件系統 TS)
庫基礎 (庫基礎 TS)
庫基礎 2 (庫基礎 TS v2)
庫基礎 3 (庫基礎 TS v3)
並行擴展 (並行 TS)
並行擴展 2 (並行 TS v2)
並發擴展 (並發 TS)
並發擴展 2 (並發 TS v2)
概念 (概念 TS)
範圍 (範圍 TS)
反射 (反射 TS)
數學特殊函數 (特殊函數 TR)
實驗性非 TS 功能特性
模式匹配
線性代數
std::execution
契約
2D 圖形
 
 
通用工具庫
工具組件
函數對象
greater_equal
元編程與類型特性
帶標籤對偶與元組
                          
標籤說明符
                                      
                          
 
template< class T = void >

    requires StrictTotallyOrdered<T> ||
             Same<T, void> ||
             /* 兩個 const T 左值上的 < 調用比較指針的內建運算符 */

struct greater_equal;
(範圍 TS)
template<>
struct greater_equal<void>;
(範圍 TS)

進行比較的函數對象。主模板調用 T 類型的 const 左值上的 operator< 並對結果取反。特化 greater_equal<void> 從實參推導函數調用運算符的形參類型(但非返回類型)。

greater_equal 的所有特化均為 Semiregular

目錄

[編輯] 成員類型

成員類型 定義
is_transparent (僅為 greater_equal<void> 特化的成員) /* 未指定 */

[編輯] 成員函數

operator()
檢查第一實參是否大於等於第二個
(公開成員函數)

std::experimental::ranges::greater_equal::operator()

constexpr bool operator()(const T& x, const T& y) const;
(1) (僅為主 greater_equal<T> 模板的成員)
template< class T, class U >

    requires ranges::StrictTotallyOrderedWith<T, U> ||
             /* std::declval<T>() < std::declval<U>()
                解析成比較指針的內建運算符 */

constexpr bool operator()(T&& t, U&& u) const;
(2) (僅為 greater_equal<void> 特化的成員)
1) 比較 xy。等價於 return !ranges::less<>{}(x, y)
2) 比較 tu。等價於 return !ranges::less<>{}(std::forward<T>(t), std::forward<U>(u));

[編輯] 註解

不同於 std::greater_equalranges::greater_equal 要求六個比較運算符 <<=>>===!= 均合法(通過 StrictTotallyOrderedStrictTotallyOrderedWith 制約)並且完全以 ranges::less 定義。然而,實現可以自由地直接使用 operator>= ,因為這些運算符要求比較運算符的結果一致。

[編輯] 示例

[編輯] 參閱

實現 x >= y 的函數對象
(類模板) [編輯]