std::experi...::less_equal(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::experi...::less_equal(3) πŸ’…

okay bestie, welcome to the C++ Standard Libary manual β€” yes, that's the manual name, folded in right here at the top so we don't forget it. This page is all about std::experimental::ranges::less_equal, and it's giving tiny comparison function object with big rules energy. πŸ¦‹


🌸 NAME 🌸

  • std::experimental::ranges::less_equal β€” std::experimental::ranges::less_equal

No cap, that's the whole name block. πŸ’–


✨ Synopsis ✨

Defined in header <experimental/ranges/functional>
template< class T = void >

    requires StrictTotallyOrdered<T> ||
             Same<T, void> ||
(ranges TS)
             /* < on two const T lvalues invokes a built-in operator
                comparing pointers */

struct less_equal;
template<>
(ranges TS)
struct less_equal<void>;

Function object for performing comparisons. The primary template invokes operator< on const lvalues of type T with the argument order inverted and then negates the result. The specialization less_equal<void> deduces the parameter types of the function call operator from the arguments (but not the return type).

All specializations of less_equal are Semiregular. 🫢


πŸŽ€ Member types πŸŽ€

Member type β†’ Definition, iykyk:

  • is_transparent β€” (member only of less_equal<void> specialization) /* unspecified */

πŸ’… Member functions πŸ’…

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

πŸ¦‹ std::experimental::ranges::less_equal::operator() πŸ¦‹

Two overloads, bestie. Let's go:

(1) β€” member only of primary less_equal<T> template

constexpr bool operator()(const T& x, const T& y) const;

Compares x and y. Equivalent to return !ranges::less<>{}(y, x);.

(2) β€” member only of less_equal<void> specialization

template< class T, class U >

    requires StrictTotallyOrderedWith<T, U> ||
             /* std::declval<T>() <
                std::declval<U>() 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));.


🌈 Notes 🌈

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


πŸ“ Example πŸ“

This section is incomplete.

Reason: no example 😭


πŸ‘‘ See also πŸ‘‘

  • less_equal β€” function object implementing x <= y (class template)

πŸ’€ Category πŸ’€

  • Todo no example

Signed with love by http://cppreference.com β€” version 2024.06.10 β€” for page std::experi...::less_equal(3). πŸ’–βœ¨

πŸ“¦ where this page comes from