std::logical_not
来自cppreference.com
< cpp | utility | functional
| 在标头 <functional> 定义
|
||
| template< class T > struct logical_not; |
(C++14 前) | |
| template< class T = void > struct logical_not; |
(C++14 起) | |
实现逻辑非(逻辑取反)的函数对象。相当于调用类型 T 的 operator!。
特化
|
标准库提供
|
(C++14 起) |
成员类型
| 类型 | 定义 |
result_type (C++17 中弃用)(C++20 中移除)
|
bool |
argument_type (C++17 中弃用)(C++20 中移除)
|
T
|
|
这些成员类型是通过公开继承 std::unary_function<T, bool> 获得的。 |
(C++11 前) |
成员函数
| operator() |
返回生词的逻辑非 (公开成员函数) |
std::logical_not::operator()
bool operator()( const T& arg ) const; |
(C++14 起为 constexpr) |
|
返回 arg 的逻辑非。
参数
| arg | - | 要计算逻辑非的值 |
返回值
!arg 的结果。
异常
可能会抛出由实现定义的异常。
可能的实现
constexpr // C++14 起 bool operator()(const T& arg) const { return !arg; } |