Namespaces
Variants

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

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

목차

중첩 타입

중첩 타입 정의
is_transparent unspecified

멤버 함수

operator()
lhs rhs 보다 작은지 검사합니다
(public member function)

std::less<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 <functional>
constexpr bool strictly_negative(int lhs)
{
    return std::less<>()(lhs, 0);
}
int main()
{
    constexpr signed low = 010;
    constexpr unsigned high = 10;
    std::less<> less{};
    static_assert(less(low, high));
    constexpr static auto arr = {0, -1, -2, -3, -4, -5};
    static_assert(!std::all_of(arr.begin(), arr.end(), strictly_negative));
    static_assert(std::all_of(arr.begin() + 1, arr.end(), strictly_negative));
}

결함 보고서

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

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