名稱空間
變體
操作

std::ranges::not_equal_to

來自 cppreference.com
 
 
 
函式物件
函式呼叫
(C++17)(C++23)
恆等函式物件
(C++20)
透明運算子包裝器
(C++14)
(C++14)
(C++14)
(C++14)  
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)

受限比較器
ranges::not_equal_to
(C++20)
舊繫結器和介面卡
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)  
(直到 C++17*)
(until C++17*)(until C++17*)(until C++17*)(until C++17*)
(直到 C++20*)
(直到 C++20*)
(直到 C++17*)(直到 C++17*)
(直到 C++17*)(直到 C++17*)

(直到 C++17*)
(until C++17*)(until C++17*)(until C++17*)(until C++17*)
(直到 C++20*)
(直到 C++20*)
 
定義於標頭檔案 <functional>
struct not_equal_to;
(C++20 起)

用於執行比較的函式物件。從引數推導函式呼叫運算子的引數型別(但不推導返回型別)。

目錄

[edit] 巢狀型別

巢狀型別 定義
is_transparent 未指定

[edit] 成員函式

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

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

template< class T, class U >
constexpr bool operator()( T&& t, U&& u ) const;

等價於 return !ranges::equal_to{}(std::forward<T>(t), std::forward<U>(u));

此過載僅在 std::equality_comparable_with<T, U> 滿足時才參與過載決議。

[edit] 註解

std::not_equal_to 不同,std::ranges::not_equal_to 要求 ==!= 均有效(透過 equality_comparable_with 約束),並完全由 std::ranges::equal_to 定義。

[edit] 示例

[edit] 缺陷報告

下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。

缺陷報告 應用於 釋出時的行為 正確的行為
LWG 3530 C++20 比較指標時放寬了語法檢查 僅放寬了語義要求

[edit] 參閱

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