std:: plus<void>
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ヘッダーで定義
<functional>
|
||
|
template
<>
class plus < void > ; |
(C++14以降) | |
std:: plus < void > は、パラメータと戻り値の型が推論される std::plus の特殊化です。
目次 |
メンバー型
| 型 | 定義 |
is_transparent
|
unspecified |
メンバー関数
|
operator()
|
2つの引数の合計を返す
(公開メンバ関数) |
std::plus<void>:: operator()
|
template
<
class
T,
class
U
>
constexpr
auto
operator
(
)
(
T
&&
lhs, U
&&
rhs
)
const
|
||
lhs と rhs の和を返します。
パラメータ
| lhs, rhs | - | 加算する値 |
戻り値
std:: forward < T > ( lhs ) + std:: forward < U > ( rhs ) 。
例
#include <functional> #include <iostream> int main() { auto string_plus = std::plus<void>{}; // “void” は省略可能 std::string a = "Hello "; const char* b = "world"; std::cout << string_plus(a, b) << '\n'; }
出力:
Hello world