命名空间
变体
操作

std::ranges::not_equal_to

来自 cppreference.cn
 
 
 
函数对象
函数调用
(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 的函数对象
(类模板) [编辑]