std::logical_or
来自 cppreference.cn
< cpp | utility | functional
定义于头文件 <functional> |
||
template< class T > struct logical_or; |
(C++14 前) | |
template< class T = void > struct logical_or; |
(C++14 起) | |
用于执行逻辑 OR(逻辑析取)的函数对象。 有效地在类型 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() |
返回两个参数的逻辑 OR (公共成员函数) |
std::logical_or::operator()
bool operator()( const T& lhs, const T& rhs ) const; |
(constexpr 从 C++14 起) | |
返回 lhs 和 rhs 的逻辑 OR。
参数
lhs, rhs | - | 计算逻辑 OR 的值 |
返回值
lhs || rhs 的结果。
[编辑] 异常
可能抛出实现定义的异常。
可能的实现
constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs || rhs; } |