Namespaces
Variants
Views
Actions

std::ranges::less_equal

From cppreference.com
< cpp‎ | utility‎ | functional
 
 
 
Function objects
Function wrappers
(C++11)
(C++11)
Partial function application
(C++20)
(C++11)
Function invocation
(C++17)
Identity function object
(C++20)
Reference wrappers
(C++11)(C++11)
Operator wrappers
Negators
(C++17)
Searchers
Constrained comparators
ranges::less_equal
(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)
 
Defined in header <functional>
struct less_equal;
(since C++20)

Function object for performing comparisons. Deduces the parameter types of the function call operator from the arguments (but not the return type).

Contents

[edit] Member types

Member type Definition
is_transparent /* unspecified */

[edit] Member functions

operator()
checks if the first argument is less than or equal to the second
(public member function)

std::ranges::less_equal::operator()

template< class T, class U >

    requires std::totally_ordered_with<T, U> ||
             /* std::declval<U>() < std::declval<T>() resolves to
                a built-in operator comparing pointers */

constexpr bool operator()(T&& t, U&& u) const;

Compares t and u. Equivalent to return !ranges::less{}(std::forward<U>(u), std::forward<T>(t));.

[edit] Notes

Unlike std::less_equal, std::ranges::less_equal requires all six comparison operators <, <=, >, >=, == and != to be valid (via the totally_ordered_with constraint) and is entirely defined in terms of std::ranges::less. However, the implementation is free to use operator<= directly, because those concepts require the results of the comparison operators to be consistent.

[edit] Example

[edit] See also

function object implementing x <= y
(class template) [edit]