Function Subspace :: sus :: cmp :: min_by_key

template <class T, class KeyFn, int &... , class Key = std::invoke_result_t<KeyFn &, const std::remove_reference_t<T> &>>
auto min_by_key(T a, T b, KeyFn f) -> T
requires
sus::fn::FnMut<KeyFn, ::sus::fn::NonVoid (const std::remove_reference_t<T> &)>
sus::cmp::Ord<Key>

Returns the element that gives the minimum value from the specified 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_key<i32&>(a, b, k).

Note that if either input is a temporary object this can return a reference to an object past its lifetime.