std::ranges::not_equal_to
來自 cppreference.com
| 定義於標頭檔案 <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 的函式物件 (類模板) |