Namespaces
Variants

std:: minus

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 T >
struct minus ;
(C++14 이전)
template < class T = void >
struct minus ;
(C++14 이후)

두 개의 T 타입 인스턴스에 대해 operator - 를 효과적으로 호출하는 뺄셈 연산을 수행하는 함수 객체입니다.

목차

특수화

표준 라이브러리는 T 가 지정되지 않았을 때 std::minus 의 특수화를 제공하며, 이는 매개변수 타입과 반환 타입을 추론하도록 남겨둡니다.

x - y 를 구현하는 함수 객체로 매개변수와 반환 타입을 추론함
(클래스 템플릿 특수화)
(C++14 이후)

멤버 타입

유형 정의
result_type (C++17에서 사용 중단됨) (C++20에서 제거됨) T
first_argument_type (C++17에서 사용 중단됨) (C++20에서 제거됨) T
second_argument_type (C++17에서 사용 중단됨) (C++20에서 제거됨) T

이 멤버 타입들은 공개적으로 상속받는 std:: binary_function < T, T, T > 을 통해 얻어집니다.

(C++11 이전)

멤버 함수

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

std::minus:: operator()

T operator ( ) ( const T & lhs, const T & rhs ) const ;
(constexpr since C++14)

lhs rhs 사이의 차이를 반환합니다.

매개변수

lhs, rhs - 서로 빼려는 값들

반환 값

lhs - rhs 의 결과입니다.

예외

구현에서 정의된 예외를 던질 수 있습니다.

가능한 구현

constexpr T operator()(const T& lhs, const T& rhs) const 
{
    return lhs - rhs;
}