Namespaces
Variants

std:: greater

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

비교를 수행하기 위한 함수 객체입니다. 기본 템플릿은 타입 T 에 대해 operator > 를 호출합니다.

목차

특수화

매개변수 및 반환 타입을 추론하는 x > y 를 구현하는 함수 객체
(클래스 템플릿 특수화)

멤버 타입

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

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

(C++11 이전)

멤버 함수

operator()
첫 번째 인수가 두 번째 인수보다 큰지 확인합니다
(public member function)

std::greater:: operator()

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

lhs rhs 보다 큰지 확인합니다.

매개변수

lhs, rhs - 비교할 값들

반환 값

lhs > rhs .

T 가 포인터 타입인 경우, 결과는 포인터에 대한 구현 정의 엄격한 전체 순서 와 일관됩니다.

예외

구현 정의 예외를 throw할 수 있습니다.

가능한 구현

constexpr bool operator()(const T& lhs, const T& rhs) const 
{
    return lhs > rhs; // assumes that the implementation handles pointer total order
}

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 2562 C++98 포인터 전체 순서가 일관되지 않을 수 있음 일관성 있음이 보장됨

참고 항목

x < y 를 구현하는 함수 객체
(클래스 템플릿)
x > y 를 구현하는 제약된 함수 객체
(클래스)