Namespaces
Variants

std::ranges:: not_equal_to

From cppreference.net
Utilities library
Function objects
Function invocation
(C++17) (C++23)
Identity function object
(C++20)
Old binders and adaptors
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
( until C++17* ) ( until C++17* )
( until C++17* ) ( until C++17* )

( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
定义于头文件 <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 的函数对象
(类模板)