std::experi...::less_equal(3)
π 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 ofless_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 implementingx <= 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
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms