std::ranges::not_equal_to
来自cppreference.com
< cpp | utility | functional
在标头 <functional> 定义
|
||
struct not_equal_to; |
(C++20 起) | |
进行比较的函数对象。从实参推导函数调用运算符的形参类型(但非返回类型)。
嵌套类型
嵌套类型 | 定义 |
is_transparent
|
未指定 |
成员函数
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> 时才会参与重载决议。
注解
与 std::not_equal_to 不同,std::ranges::not_equal_to
要求 ==
与 !=
都合法(经由 equality_comparable_with
约束),并且完全以 std::ranges::equal_to 定义。
示例
本节未完成 原因:暂无示例 |
缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 出版时的行为 | 正确行为 |
---|---|---|---|
LWG 3530 | C++20 | 在比较指针时放松了语法检查 | 仅放松语义要求 |
参阅
实现 x != y 的函数对象 (类模板) |