std::plus<void>
| ヘッダ <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