|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <functional> | ||
template<> class plus<void>; | (since C++14) | |
std::plus<void> is a specialization ofstd::plus with parameter and return type deduced.
Contents |
| Type | Definition |
is_transparent | unspecified |
operator() | returns the sum of two arguments (public member function)[edit] |
template<class T,class U> constexprauto operator()( T&& lhs, U&& rhs)const | ||
Returns the sum oflhs andrhs.
| lhs, rhs | - | values to sum |
std::forward<T>(lhs)+std::forward<U>(rhs).
#include <functional>#include <iostream> int main(){auto string_plus=std::plus<void>{};// “void” can be omittedstd::string a="Hello ";constchar* b="world";std::cout<< string_plus(a, b)<<'\n';}
Output:
Hello world