名稱空間
變體
操作

std::experimental::ranges::not_equal_to

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

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

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

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

not_equal_to 的所有特化都是 Semiregular

目錄

[編輯] 成員型別

成員型別 定義
is_transparent (僅在 not_equal_to<void> 特化中是成員) /* 未指定 */

[編輯] 成員函式

operator()
檢查引數是否“不相等”
(公開成員函式)

std::experimental::ranges::not_equal_to::operator()

constexpr bool operator()(const T& x, const T& y) const;
(1) (僅在主 not_equal_to<T> 模板中是成員)
template< class T, class U >

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

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

[編輯] 註解

std::not_equal_to 不同,ranges::not_equal_to 要求 ==!= 都是有效的(透過 EqualityComparableEqualityComparableWith 約束),並且完全是根據 ranges::equal_to 定義的。然而,實現可以自由地直接使用 operator!=,因為這些概念要求 ==!= 的結果保持一致。

[編輯] 示例

[編輯] 參閱

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