ΒΆtemplate <class T, class compare : auto>
constexpr T min_by(
T a,
T b,
::sus::fn::FnOnce<std::weak_ordering(
const std::remove_reference_t<T>&,
const std::remove_reference_t<T>&)> auto
compare) noexcept
template <class T, class compare : auto>
constexpr T min_by(
T a,
T b,
::sus::fn::FnOnce<std::weak_ordering(
const std::remove_reference_t<T>&,
const std::remove_reference_t<T>&)> auto
compare) noexcept
Description
Compares and returns the minimum of two values with respect to the specified comparison function. Returns the first argument if the comparison determines them to be equal. By default this receives and returns objects by value. To receive and return references, specify the type parameter, such as: `sus::cmp::min_by <i32 & >(a, b, c)`. Note that if either input is a temporary object this can return a reference to an object past its lifetime.
Declared at: sus/cmp/ord.h:177
Templates
- T
- compare:auto
Parameters
- T a
- T b
- ::sus::fn::FnOnce<std::weak_ordering( const std::remove_reference_t<T>&, const std::remove_reference_t<T>&)> auto compare