std::multiplies
来自 cppreference.cn
< cpp | utility | functional
定义于头文件 <functional> |
||
template< class T > struct multiplies; |
(until C++14) | |
template< class T = void > struct multiplies; |
(since C++14) | |
用于执行乘法运算的函数对象。 有效地对类型 T
的两个实例调用 operator*。
内容 |
[编辑] 特化
当未指定
|
(since C++14) |
[编辑] 成员类型
类型 | 定义 |
result_type (deprecated in C++17)(removed in C++20) |
T
|
first_argument_type (deprecated in C++17)(removed in C++20) |
T
|
second_argument_type (deprecated in C++17)(removed in C++20) |
T
|
这些成员类型通过公开继承 std::binary_function<T, T, T> 获得。 |
(until C++11) |
[编辑] 成员函数
operator() |
返回两个参数的乘积 (公共成员函数) |
std::multiplies::operator()
T operator()( const T& lhs, const T& rhs ) const; |
(constexpr since C++14) | |
返回 lhs 和 rhs 的乘积。
参数
lhs, rhs | - | 要相乘的值 |
返回值
lhs * rhs 的结果。
[编辑] 异常
可能抛出实现定义的异常。
可能的实现
constexpr T operator()(const T& lhs, const T& rhs) const { return lhs * rhs; } |