Namespaces
Variants

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

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

목차

중첩 타입

중첩 타입 정의
is_transparent unspecified

멤버 함수

operator()
lhs rhs 보다 큰지 비교합니다
(public member function)

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

template < class T, class U >

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

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

std:: forward < T > ( lhs ) > std:: forward < U > ( rhs ) 의 결과를 반환합니다.

매개변수

lhs, rhs - 비교할 값들

반환 값

std:: forward < T > ( lhs ) > std:: forward < U > ( rhs ) .

포인터를 비교하는 내장 연산자가 호출되는 경우, 그 결과는 구현에서 정의된 포인터에 대한 엄격한 전체 순서 와 일관됩니다.

예외

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

예제

#include <algorithm>
#include <cstdint>
#include <functional>
constexpr bool strictly_positive(int lhs)
{
    return std::greater<>()(lhs, 0);
}
int main()
{
    constexpr std::int64_t low = 0B11;
    constexpr std::uint16_t high = 0X11;
    std::greater<> greater{};
    static_assert(greater(high, low));
    constexpr static auto arr = {0, 1, 2, 3, 4, 5};
    static_assert(!std::all_of(arr.begin(), arr.end(), strictly_positive));
    static_assert(std::all_of(arr.begin() + 1, arr.end(), strictly_positive));
}

결함 보고서

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

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