std::min_element
will return the smallest element as defined either by operator<(T,T)
or by a custom predicate bool Pred(T,T)
. Is there a similar function which returns the element for which the projection function f(T)->R
takes on the minimal value?
Obviously I can define bool Pred(t1,t2) { return f(t1) < f(t2); }
but that's a bit inconvenient when f is a lambda.