std::modulus
From cppreference.com
< cpp | utility | functional
| ヘッダ <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 |
(C++11まで) |
[編集] メンバ関数
| operator() |
最初の引数を2番目の引数で割ったときの剰余を返します (public member function) |
std::modulus::operator()
T operator()( const T& lhs, const T& rhs ) const; |
(C++14以降constexpr) | |
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) |
除算操作における符号付き剰余 (関数) |