std::plus<void>
From cppreference.com
< cpp | utility | functional
| ヘッダ <functional> で定義 |
||
| template<> class plus<void>; |
(C++14以降) | |
std::plus<void> は、パラメータ型と戻り値の型が推論される std::plus の特殊化です。
目次 |
[編集] メンバ型
| 型 | 定義 |
is_transparent
|
unspecified |
[編集] メンバ関数
| operator() |
2つの引数の合計を返す (public member function) |
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” can be omitted std::string a = "Hello "; const char* b = "world"; std::cout << string_plus(a, b) << '\n'; }
出力
Hello world