std:: modulus
| 
 | 
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
           定义于头文件
            
            
             <functional>
            
            | ||
| 
           
            
             template
            
            
             <
            
            
             class
            
            T
            
             >
            
             struct modulus ; | (C++14 前) | |
| 
           
            
             template
            
            
             <
            
            
             class
            
            T
            
             =
            
            
             void
            
            
             >
            
             struct modulus ; | (C++14 起) | |
       用于计算除法余数的函数对象。为类型
       
        T
       
       实现
       
        
         operator
         
          %
         
        
       
       。
      
| 目录 | 
特化
| 
          当未指定
           
 | (C++14 起) | 
成员类型
| 类型 | 定义 | 
| 
          result_type
         (C++17 中弃用)
         
         
          (C++20 中移除) | 
          T
          | 
| 
          first_argument_type
         (C++17 中弃用)
         
         
          (C++20 中移除) | 
          T
          | 
| 
          second_argument_type
         (C++17 中弃用)
         
         
          (C++20 中移除) | 
          T
          | 
| 这些成员类型通过公开继承 std:: binary_function < T, T, T > 获得。 | (until C++11) | 
成员函数
| 
           
            
             operator()
            
           
           | 返回第一个参数除以第二个参数的余数 (公开成员函数) | 
std::modulus:: 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; } | 
参见
| 
           
            
            
            
             
              (C++11)
             
            
            
             
              (C++11)
             
            
           
           | 浮点除法运算的余数 (函数) | 
| 
           
            
             
              (C++11)
             
            
            
             
              (C++11)
             
            
            
             
              (C++11)
             
            
           
           | 带符号的除法运算余数 (函数) |