std::plus
From cppreference.com
< cpp | utility | functional
| ヘッダ <functional> で定義 |
||
| template< class T > struct plus; |
(C++14まで) | |
| template< class T = void > struct plus; |
(C++14以降) | |
加算を実行する関数オブジェクト。実質的には、型Tの2つのインスタンスに対して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 メンバ関数) |
std::plus::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; } |