Namespaces
Variants

std:: minus<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 minus < void > ;
(C++14부터)

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

목차

멤버 타입

타입 정의
is_transparent unspecified

멤버 함수

operator()
두 인자의 차이를 반환합니다
(public member function)

std::minus<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 <complex>
#include <functional>
#include <iostream>
int main()
{
    auto complex_minus = std::minus<void>{}; // "void"는 생략 가능
    constexpr std::complex<int> z(4, 2);
    std::cout << complex_minus(z, 1) << '\n';
    std::cout << (z - 1) << '\n';
}

출력:

(3,2)
(3,2)