std::less_equal<void>

Header: <functional>

std::less_equal is a specialization of std::less_equal with parameter and return type deduced.

# Declarations

template<>
class less_equal<void>;

(since C++14)

# Parameters

# Return value

std::forward(lhs) <= std::forward(rhs).

# Example

#include <algorithm>
#include <functional>
#include <initializer_list>
 
constexpr bool strictly_not_positive(int lhs)
{
    return std::less_equal<>()(lhs, 0);
}
 
int main()
{
    constexpr int low = 0, high = 8;
    std::less_equal<> less_equal{};
    static_assert(less_equal(low, high));
    static_assert(less_equal(low, low));
 
    static constexpr auto arr = {1, 0, -1, -2, -3, -4};
    static_assert(!std::all_of(arr.begin(), arr.end(), strictly_not_positive));
    static_assert(std::all_of(arr.begin() + 1, arr.end(), strictly_not_positive));
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2562C++98the pointer total order might be inconsistentguaranteed to be consistent