std::logical_and
来自 cppreference.cn
定义于头文件 <functional> |
||
template< class T > struct logical_and; |
(直到 C++14) | |
template< class T = void > struct logical_and; |
(C++14 起) | |
用于执行逻辑与(逻辑合取)的函数对象。实际上对类型T
调用operator&&。
目录 |
[编辑] 特化
当未指定
|
(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::logical_and::operator()
bool operator()( const T& lhs, const T& rhs ) const; |
(C++14 起为 constexpr) | |
返回lhs和rhs的逻辑与。
参数
lhs, rhs | - | 要计算逻辑与的值 |
返回值
lhs && rhs的结果。
[编辑] 异常
可能抛出实现定义的异常。
可能的实现
constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs && rhs; } |