名稱空間
變體
操作

std::experimental::ranges::less_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 圖形
 
 
通用工具庫
實用元件
函式物件
less_equal
超程式設計和型別特徵
帶標籤的對和元組
                          
tag specifiers
                                      
                          
 
定義於標頭檔案 <experimental/ranges/functional>
template< class T = void >

    requires StrictTotallyOrdered<T> ||
             Same<T, void> ||
             /* < 對兩個 const T 左值呼叫內建的指標比較運算子 */

struct less_equal;
(ranges TS)
template<>
struct less_equal<void>;
(ranges TS)

用於執行比較的函式物件。主模板在型別為 T 的 const 左值上以反轉的引數順序呼叫 operator<,然後對結果取反。特化 less_equal<void> 從引數推導函式呼叫運算子的引數型別(但不是返回型別)。

less_equal 的所有特化都是 Semiregular

目錄

[編輯] 成員型別

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

[編輯] 成員函式

operator()
檢查第一個引數是否小於或等於第二個引數
(公開成員函式)

std::experimental::ranges::less_equal::operator()

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

    requires StrictTotallyOrderedWith<T, U> ||
             /* std::declval<T>() < std::declval<U>() 解析為
                內建的指標比較運算子 */

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

[編輯] 注意

std::less_equal 不同,ranges::less_equal 要求所有六個比較運算子 <, <=, >, >=, ==!= 都是有效的(透過 StrictTotallyOrderedStrictTotallyOrderedWith 約束),並且完全是根據 ranges::less 定義的。然而,實現可以自由地直接使用 operator<=,因為這些概念要求比較運算子的結果是一致的。

[編輯] 示例

[編輯] 參閱

實現 x <= y 的函式物件
(類模板) [編輯]