std::modulus
STD::模数
Defined in header | | |
---|---|---|
template< class T > struct modulus; | | (until C++14) |
template< class T = void > struct modulus; | | (since C++14) |
用于计算除数的函数对象。实施器operator%
类型T
...
专门性
The standard library provides a specialization of std::modulus when T is not specified, which leaves the parameter types and return type to be deduced. modulus | modulus | function object implementing x % y deducing argument and return types (class template specialization) | (since C++14) |
---|---|---|---|
modulus<void> | function object implementing x % y deducing argument and return types (class template specialization) |
成员类型
Type | Definition |
---|---|
result_type(deprecated in C++17) | T |
first_argument_type(deprecated in C++17) | T |
second_argument_type(deprecated in C++17) | T |
成员函数
operator() | returns the remainder from the division of the first argument by the second argument (public member function) |
---|
STD::模数::操作员%28%29
T operator()( const T& lhs, const T& rhs ) const; | | (until C++14) |
---|---|---|
constexpr T operator()( const T& lhs, const T& rhs ) const; | | (since C++14) |
的除法的其余部分。lhs
通过rhs
...
参数
lhs, rhs | - | values to divide one by another |
---|
返回值
结果lhs % rhs
...
例外
%280%29
可能的实施
ConstT算子%28%29%28 const T&lhs,const T&rhs%29 const{返回lhs%rhs;}
*。
另见
fmod | remainder of the floating point division operation (function) |
---|---|
remainder (C++11) | signed remainder of the division operation (function) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。