std::not_equal_to
来自cppreference.com
< cpp | utility | functional
工具库
函数对象
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
旧绑定器与适配器 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
在标头
<functional>
定义
|
||
template< class T >
struct not_equal_to; |
(C++14 前) | |
template< class T = void >
struct not_equal_to; |
(C++14 起) | |
进行比较的函数对象。除非特化,调用类型 T
上的 operator!= 。
特化
标准库提供n
|
(C++14 起) |
成员类型
类型 | 定义 |
result_type (C++17
中弃用)(C++20 中移除)
|
bool |
first_argument_type (C++17
中弃用)(C++20 中移除)
|
T
|
second_argument_type (C++17
中弃用)(C++20 中移除)
|
T
|
这些成员类型由公开继承 std::binary_function<T, T, bool> 获得。 |
(C++11 前) |
成员函数
operator()
|
检查参数是否不相等 (公开成员函数) |
std::not_equal_to::operator()
bool
operator()( const T& lhs, const T& rhs ) const;
|
(C++14 前) | |
constexpr
bool operator()( const T& lhs, const T& rhs ) const;
|
(C++14 起) | |
检查 lhs
是否不等于 rhs
。
参数
lhs, rhs | - | 要比较的值 |
返回值
若 lhs != rhs 则为 true ,否则为 false 。
异常
可能会抛出由实现定义的异常。
可能的实现
constexpr bool operator()(const T &lhs, const T &rhs) const { return lhs != rhs; } |