Namespaces
Variants

std:: plus<void>

From cppreference.net
Utilities library
Function objects
Function invocation
(C++17) (C++23)
Identity function object
(C++20)
Old binders and adaptors
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
( until C++17* ) ( until C++17* )
( until C++17* ) ( until C++17* )

( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
헤더에 정의됨 <functional>
template <>
class plus < void > ;
(C++14 이후)

std:: plus < void > 는 매개변수와 반환 타입이 추론된 std::plus 의 특수화입니다.

목차

멤버 타입

타입 정의
is_transparent unspecified

멤버 함수

operator()
두 인자의 합을 반환합니다
(public member function)

std::plus<void>:: operator()

template < class T, class U >

constexpr auto operator ( ) ( T && lhs, U && rhs ) const

- > decltype ( std:: forward < T > ( lhs ) + std:: forward < U > ( rhs ) ) ;

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